-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New sign ups Free email Newsletter notifications has a wrong from email address #17922
Comments
The same issue was recently reported on the Ghost forum by a different user and a different version: 5.59.4: https://forum.ghost.org/t/staff-new-sign-ups-email-notifications-has-a-wrong-from-email-address/40671 |
I can confirm I'm experiencing this issue as well. I just hadn't noticed because email programs don't always display the email address these days, so the issue may be more widespread than is being reported. The earliest message with the issue is August 14th. Unfortunately, I've emptied my trash so I don't have an earlier message where I can confirm the address is set as intended, but I believe it was something other than [email protected] before. Sorry, I don't have the version handy where I ran into the issue-- I've also upgraded since then. I'm not using Docker and am using Ubuntu 22, installed using the CLI. |
I'm able to confirm this is a bug in Ghost. Here's how I isolated and confirmed the issue. First, I'm aware that the First, I observed that headers are correct for the email that goes to the user to invite them to confirm. This are correct both when Ghost generates them and when I receive them in my inbox. Here's what that looks like in the logs. Notice the MAIL FROM, the "From:" and the encoded subject line:
Now here's the same output for the "New Member Signup" email that goes to admins. Now here, notice the MAIL FROM and "From:" here are different and wrong:
If there were a problem with a library Ghost was using, I believe they would both be wrong. This finding seems to point to a bug in Ghost itself in how it calls Nodemailer, specifically for the New Member Signup emails. |
I tracked this down in the source code to a change made about a year ago by @SimonBackx . It was made to fix a couple product issues which are private, but the title of the commit says "Fixed sending emails from email domain includes 'www subdomain': Even before, the email for these appeared to be The use of To avoid confusion, I recommend further simplifying things by using Here's the specific part of the diff where 2e85ae9#diff-16c79093b7a37ab53b6148b7341ee29987bccfc38d9afe12ffd8ce525dc3f564L256 |
I've submitted a PR with a proposal to use |
Thank you @markstos for such test and information. |
I found this report from 2021: |
This issue is currently awaiting triage from @daniellockyer. We're having a busy time right now, but we'll update this issue ASAP. If you have any more information to help us triage faster please leave us some comments. Thank you for understanding 🙂 |
Our bot has automatically marked this issue as stale because there has not been any activity here in some time. The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR. We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂 |
The email sending setup has now changed after #12802 (comment) - please give that a read and let us know if it's still broken 🙂 |
I will test it, I was aware of the changes. |
Looks like the issue is still there: |
Here are all the places were
We can see it's generally used as a default and can be overridden. I wonder if the OP is running to this edge case in NewslettersService.js: async sendEmailVerificationMagicLink({id, email, property = 'sender_from'}) {
const [,toDomain] = email.split('@');
let fromEmail = `noreply@${toDomain}`;
if (fromEmail === email) {
fromEmail = `no-reply@${toDomain}`;
}
if (this.emailAddressService.service.useNewEmailAddresses) {
// Gone with the old logic: always use the default email address here
// We don't need to validate the FROM address, only the to address
// Also because we are not only validating FROM addresses, but also possible REPLY-TO addresses, which we won't send FROM
fromEmail = this.emailAddressService.service.defaultFromAddress;
} That seems to say that if the "From email" is the same as the "To" email, then noreply will be used-- a code comment there would be great to explain why. But even, it seems that I'm not clear how |
I am experiencing this issue as well, so it is still around. This makes self-hosting unusable since you can't create accounts if your email provider has sender-verification. I.E. Ghost is hosted at |
@markstos The problem is actually here:
On a new setup, You can see on line 126 it then gets set to
And then to
No idea why that code is written with multiple statements since it could be significantly cut down. In any event, forcing that function to return a string of I think an environment variable needs to be configured to support this, and/or it should default to the config item EDIT: |
I am using 5.108.0. Issue still exist |
Hey everyone, I kept receiving email updates on this issue, and today, I finally decided to try it out on my machine. I managed to fix the problem, and in hindsight, the cause was completely my own mistake—something that might seem obvious now, but took me a while to catch. As I mentioned earlier, I had already set everything in my I configured the Since I was using Docker, I decided to make the change more straightforward by setting At this point, I was certain that the issue was with my configuration. After carefully reviewing my settings, I discovered my mistake: ❌ Incorrect configuration (the mistake)"mail": {
"transport": "SMTP",
"options": {
"service": "Gmail",
"host": "smtp.gmail.com",
"port": 465,
"secure": true,
"auth": {
"user": "redacted",
"pass": "redacted"
},
"from":”my email <hi@mydomain>”
}
} The issue? I accidentally placed "from" under mail.options instead of directly under mail. 🤦 ✅ Correct configuration"mail": {
"from": "my email <hi@mydomain>",
"transport": "SMTP",
"options": {
"service": "Gmail",
"host": "smtp.gmail.com",
"port": 465,
"secure": true,
"auth": {
"user": "redacted",
"pass": "redacted"
}
}
} Once I moved "from" to the correct place (mail.from), everything started working properly. I ignored this mainly because ghost put mail.from part https://ghost.org/docs/config/#mail behind other part of the mail config, so that I made this mistake and never found out. Hopefully, this helps anyone facing the same issue! If this worked for you, let me know. I honestly feel so dumb for missing such a simple mistake… LMFAO. 😅 |
@MFYDev Glad you were able to figure this out for yourself! But for any maintainer thinking this issue should be closed:
The catch is if you are using a "mail": {
"transport": "Direct"
}, And your
With this configuration, you hit the issue when you shouldn't, and is what the analysis in #17922 (comment) demonstrates. |
Can confirm I'm running into this bug with a new installation of Ghost under Docker. There appears to be no way to set the To work around this, I edited the database directly using hints from the code @Fmstrat discovered:
|
Issue Summary
Explain roughly what’s wrong:
There are a lot of themes that use a non pop up subscribe option and those are the ones that are not working.
The new sign up notification from email address is supposed to be [email protected]. I have already set up all from email address as another address using the smtp config. That email is used for password reset and welcome emails.
To change the newsletter email, that was also sent from the wrong email address.
Even with that wrong, I clicked on the link to replace it and now the newsletter settings shows the right one, but the signups are still being sent from the wrong address.
What did you expect to happen?
Both the email to change the newsletter from address and the new signups for new free subscribers should receive the confirmation email using the SMTP setup email and/or the newsletter one. Not the default [email protected]
Steps to Reproduce
New install.
activate the theme Edition https://github.com/TryGhost/Edition/
go to Settings → Newsletter → Customise- change email- that one will be sent from the wrong email.
Approve that change (if you managed to get the email as I did).
Then confirm that has been changed.
Subscribe to the free emails using a custom embebed form from the theme, not the portal one.
The email is again sent from the wrong one.
Ghost Version
5.60.0
Node.js Version
v18.17.1
How did you install Ghost?
ubuntu 22 following guide and ghost cli
Database type
MySQL 8
Browser & OS version
No response
Relevant log / error output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: