SMTP email sending from wrong host

AI-generated summary

The discussion revolves around SMTP email sending from a wrong host in Discourse. frostyfrog faces issues with emails being sent from noreply@myvps.do.example.com instead of example.com, causing Google to reject them due to strict SPF and DKIM rules. pfaffman suggests editing the app.yml file to change the sending address, which frostyfrog had missed. elijah explains that the setting is a database edit, unlike other SMTP settings that are passed by environment, which is why it’s easily overlooked.

I’ve looked at the configs and I can’t figure out how to change the host that email is being sent from, other than changing the DISCOURSE_HOSTNAME variable. However, based on the comments, If I change that to say… example(dot)com, then if I visit VPS.provider.example(dot)com, I will no longer see the discourse service.

Alrighty, let’s see if I can make that a bit clearer now… (my real domain is replaced with example.com)

  • My VPS hosting discourse is on a different machine than my email server (due to the fact that I don’t trust the discourse-setup and launcher scripts being run as root).
  • My email server serves email from example(dot)com
  • Discourse is running on myvps.do.example(dot)com
  • Discourse is logging into smtp.example(dot)com to send emails
  • Discourse is sending emails from noreply@myvps.do.example(dot)com
  • Google receives the email and throws it away due to strict SPF and DKIM rules
  • Google sends me an email of said rejection by the next day via the DMARC system

I’m not sure what I can do to fix this, is there anyway to change the sending address? (I’ll be taking a look into spoofing the header.from=myvps.do.example.com from the postfix side to see if that helps at all) I’m able to login to the system since I can send emails to example(dot)com and be just fine, but sending to other email providers is another story.

There is a commented line at the bottom of app.yml that will change the sending address. Just edit it with your address and rebuild.

Alright, thanks. I must’ve missed it since it wasn’t in the same place as the other SMTP settings. :confused:

It’s a bit tricky because the other settings are all passed by environment (needed on every container start-up), but that one is a database edit (needed only once ever).