Mail 'from' option shows no effect

ghost has no connection issue with my mail server, but rather a credentials issue because it is not respecting the “from” parameter of my config. I only tested so far as starting up my docker compose stack, going on the site and go for sign up at the bottom of the page. A friend of mine got the notification via the logs so he could lot in, but this is not acceptable for me when I want to use ghost in production.

1 Like

@aronmal Can you try inviting a new staff member? For me the from field is respected here

As I said earlier, there is something wrong with your config. It would seem that Ghost is using different username from the email you’re trying to send.

I pointed to this in my opening post.

For members related emails the from address is set to your members support address configured in your membership settings inside the admin area. You can find it in Settings > Membership > Portal settings

2 Likes

@marnix I am currently on the road, but I will try to create an account via the log/notification way and then invite staff via mail when I’m back

@mjw
Let me start over:

  • My site is public on: blog.domain.de
  • The Mail Account credentials are: noreply@domain.de/sEcUrEpAsSwOrD
  • And the mail account can send mails from surprise noreply@domain.de (as well as x@domain.de and y@domain.de because of aliases, but that does not matter for here.)
  • Ghost is logging in on my mail server correctly, but is trying to send from: noreply@blog.domain.de because it is the default.
  • I want to overwrite this behavior with the “from” parameter which sadly is not being respected.
1 Like

@Kevin, thank you soooo much! This solved my issue. :smiley:

I did not know that member related messages (subscribe emails and “Contact support” button) are using the email address defined here.

It might help others to add this to the mail configuration documentation?

Again, thank you so much! I have only just started using Ghost, but I already love it :slight_smile:

2 Likes

I am using now enviroment variables in my docker compose stack:

    environment:
      - url=https://blog.domain.de/
      - mail__transport="SMTP"
      - mail__from="noreply@domain.de"
      - mail__options__service="SMTP"
      - mail__options__host="smtp.domain.de"
      - mail__options__port="587"
      - mail__options__auth__user="noreply@domain.de"
      - mail__options__auth__pass="password"
      - database__client=mysql
      - database__connection__host=10.1.0.37
      - database__connection__user=ghostdb
      - database__connection__password=password
      - database__connection__database=ghostdb
      - VIRTUAL_HOST=blog.domain.de
      - VIRTUAL_PORT=2368

and tried to change the from address for support:

which did not wanted to save and got this error in logs:

Failed to send email. Reason: Can't send mail - all recipients were rejected: 553 5.7.1 <no-reply@domain.de>: Sender address rejected: not owned by user noreply@domain.de.

I mean, somewhat of progress thanks to @Kevin , but still… no-reply@???
Where is that coming from :sob:.

1 Like

@aronmal I just did some digging through the Ghost source code and I found this line.

I am not sure if you are a developer or not, but what it means is that if you supply a noreply@ email, then it will use no-reply@ instead. Don’t ask me why Ghost does this…

But I’d suggest to try an email address that does not start with noreply@. Let me know if it works! :)

Ok, I indeed can now confirm the following points from my side:

  • the “form” parameter is (as far as I know) only being used for inviting new staff members who are then getting a link to be authorized to get registered by themself.
  • there is also the newsletter dispatch, as well as the displayed and linked support email addresses which both can be set in the dashboard, BUT cat not be set to noreply@ because of hard coded overwrite logic to no-reply@.

I think it’s very important to somehow include this information in the documentation!!!

And I think I speak for everyone here except our expert @Kevin. Thanks again!

1 Like

Btw. I can’t edit the thread headline or my initial post. Can a moderator here add a (Solved) so others can find this more easily.

I just wanted to create a pull request to the ghost docs GitHub repository, but it is archived. Why?

1 Like

Why is the noreply@ prefix hard-coded?

I have a fix (I think). It works for me in self-hosted mode. I will push the changes to ghost repo soon. If you’re self-hosting, try below workaround:

in /var/lib/ghost/current/core/server/services/mail/GhostMailer.js -
replace
const address = requestedFromAddress || configAddress;
with
const address = configAddress || requestedFromAddress;

Submitted the PR here: Fix for Mail ‘from’ option shows no effect by mandarons · Pull Request #15989 · TryGhost/Ghost · GitHub

sad that 7 months have passed yet noone could review and merge it. As of now Ghost is unusable without the fix

Does ghost core have any interest in sorting this?

Outlook flags as spam and o or adds “on behalf of” due to how Ghost sets the envelope and send from address.