Reference https://github.com/TryGhost/Ghost/blob/master/core/server/services/members/api.js
line 206 - 224
transporter: {
sendMail(message) {
if (process.env.NODE_ENV !== 'production') {
common.logging.warn(message.text);
}
let msg = Object.assign({
subject: 'Signin',
forceTextContent: true
}, message);
const subscriptionSettings = settingsCache.get('members_subscription_settings');
if (subscriptionSettings && subscriptionSettings.fromAddress) {
let from = `${subscriptionSettings.fromAddress}@${getDomain()}`;
msg = Object.assign({from: from}, msg);
}
return ghostMailer.send(msg);
}
},
The from address is set via the database and automatically append the domain. Whereas we have a mail setting in the config which would be better or at least we should remove the get domain part
I'm happy to fix this but not sure which is best approach
Hi @Jordan-Hall :wave: Could you explain your usecase for using a different domain for the from address? Not really following what you mean by:
we have a mail setting in the config which would be better or at least we should remove the get domain part
Do you want to reuse the same mail setting as for general Ghost mailer or do you just want to have a possibility to provide custom from address for member emails?
We use GitHub for issue/bug tracking mostly. So, I'm gonna close this issue here but happy to continue the discussion on the forum and then possibly reopening it here ;)
@gargol the issue is members always getting getDomain() of the website and the mail-in config doesn't overwrite the from address.
So we have kks.news whereas for emails we use kks.email
Roger :+1: Think it makes sense to allow setting a custom domain from config or similar mechanism. This is a first time I'm seeing this usecase that's why wanted to go with our standard way of discussing new "features" :)
I just stumbled on this after creating a ticket in the members package: https://github.com/TryGhost/Members/issues/109 I can close it, but I believe this is a Bug and not a feature request. Coupling the email domain to the hosting domain is just wrong.
@the-architect that was my view but apparently its a feature :/
@the-architect Agree, it's coupling two unrelated concepts - it should be separate.
I'm looking at the code and unlike the rest of the system, it uses settings rather than config. 🤷♂️ No offence Ghost architecture seems to be odd :/ You can change the fromAddress in the admin section. Thinking now the best protocol would be to append a new config setting called domain.
This would have breaking change but we could add a deprecated warning to split the from address up. This seems to be the best approach.
@Jordan-Hall Where did you find that in the admin section? Can you do a screenshot?
You can only change the from not the domain. I'll send over a screenshot after. I'll have a solution within the next 48 hours

@piotrkundu it wont change domain though but here. I think the domain should come from config
Ah, ok. You need to have members enabled first to get it. Yeah I've seen that before. Turn off members and try your config like this:
"mail": {
"from": "[email protected]",
"transport": "DIRECT",
"options": {}
},
That worked from me, after wasting 8-10 billable hours :(
@piotrkundu Tried that the from not used for members. it means your limited to the domain of the blog
This feature needs more thought on a proper approach to allow domain modification for non-self-hosted versions of Ghost. It will be reviewed once the issue gets a priority.
For now, the fork from https://github.com/TryGhost/Ghost/pull/11474 and https://github.com/TryGhost/Ghost-Admin/pull/1432 can be used by anybody who needs this feature. Bear in mind it is not a final solution and might get changed.
Just to mention another use case for this: I currently host a blog at www.[blog].com. Because of technical requirements given the infrastructure setup we chose not to use [blog].com. So the emails here must come from [person]@www.[blog].com instead of [person]@[blog].com, which means we also have to configure MX records etc etc to receive replies at that email address. This issue would also be the same for anyone hosting their blog on a subdomain. Emails would come from [person]@blog.[website].com instead of [person]@[website].com
Another use case: my blog is [firstname][lastname].com and my email is [firstname]@[lastname].com - I'd like emails to come from me because it seems more personal.
I have both domains on my mailgun account and assumed changing the "mailgun domain" setting in the members section would change the from domain, but it doesn't have any effect.
I also found it a bit confusing that there seem to be two sets of email configurations - one for ghost admin and another for members.
That said, it's not a blocker - I still love ghost. ❤️
I have both domains on my mailgun account and assumed changing the "mailgun domain" setting in the members section would change the from domain, but it doesn't have any effect.
Changing the mailgun domain to does have an effect. While it doesn't change the "from" address, it changes the domain used to sign the messages which results in the dreaded sent "via" message in gmail and causes messages to get blocked by microsoft's email services and some other providers.
The problem didn't show up in the test messages because I didn't bother to inspect the headers until a number of messages failed delivery. The solution is to make sure your mailgun domain matches the blog domain. I wanted to share this in case anyone else runs into the same problem.