jacobobryant / platypub

A publishing platform built with Biff
MIT License
65 stars 13 forks source link

Sending domain is hard-coded in post/render-email #25

Closed jeffp42ker closed 2 years ago

jeffp42ker commented 2 years ago

In the posts/render-email function, the sending domain used in the value for the :from key is currently hard-coded to "doreply@m.platypub.com" https://github.com/jacobobryant/platypub/blob/e7c59558dabc18d67077031f5283bd901d2e58c1/src/com/platypub/feat/posts.clj#L154 Replacing the address with the newsletter's :posts/reply-to value is working for me right now.

Do we also need a separate attribute for the sending domain, for cases where the :post/reply-to value should differ from the sending domain?

I don't have much experience with this. The "doreply" account name is interesting.

jacobobryant commented 2 years ago

Oh yeah, that shouldn't have been hardcoded. I assume you meant :list/reply-to rather than :post/reply-to. Generally I've always used the sending domain that's been configured in Mailgun for the From header, and the only reason I set the Reply-To header is because free Mailgun accounts no longer let you receive mail through them. (i.e. setting Reply-To lets you route replies directly to your personal account instead of having them go through Mailgun).

I am not 100% familiar myself with the spam filtering considerations. The domain in Mailgun (m.platypub.com in my case) is authenticated with DNS records, which is important for not getting flagged as spam. From what I could tell, it seemed like setting a random address for the Reply-To header was ok though (?), which honestly was a little surprising to me. Maybe it also doesn't matter for the From header, but just to be safe might as well use the Mailgun domain for that. I should perhaps check the open rates etc on the emails I have sent with Platypub and see if they look normal.

Anyway--I'll push a commit in a second here that replaces m.platypub.com with the value of :mailgun/domain from config.edn. If/when Platypub allows different users to set their own API keys, we'd probably want to store the API keys on the :user document, but for now that's tangential.

The doreply is kind of a joke, since donotreply, while common and necessary in certain situations, is more of an antipattern for newsletter writers.

jeffp42ker commented 2 years ago

FYI, Cloudflare has a beta Email Routing feature I setup so contact@mydomain gets routed to a personal email address. Since the related email DNS config is managed on Cloudflare this kinda makes sense.