I have Bitnami distro of Ghost version 5.37.0 running on Amazon Lightsail and I’m having a difficult time getting Mailgun to work.
- I’ve requested that ports 25, 465, and 587 be opened by Amazon.
- I’ve configured my config.production.json:
"from": "reTHINK HOA BLOG <firstname.lastname@example.org>",
- When I invite a Staff, I’m getting error message:
Error sending email! Error sending email: Failed to send email. Reason: Invalid login: 535 5.7.139 Authentication unsuccessful, the user credentials were incorrect. [MW4PR04CA0084.namprd04.prod.outlook.com 2023-03-20T15:10:09.763Z 08DB2840C71EDC7D]. Please check your email settings and resend the invitation.
- When I try to Sign up or Sign in as a member, I get error message:
Oops! There was an error sending the email, please try later
Any help troubleshooting would greatly be appreciated!
There is an authentication error. Double check the password—it’s something like 24 chars.-8 chars.-8 chars.
Additionally, if you’re in Europe, make sure to use smtp.eu.mailgun.org.
If you’re still having problems, diagnose with Swaks.
Thanks for suggesting swaks, @mjw .
So it seems I’m able to successfully send using swaks…but I’m still not able to send from ghost. I’ve restarted the servers just in case, but I’m still getting an invalid login/authentication unsuccessful error. Should I use port 25 instead of 587
$ ./swaks --auth --server smtp.mailgun.org --au email@example.com --ap <same password as the one in the config.production.json> --to rei...@gmail.com --h-Subject: "Hello" --body 'Testing some Mailgun awesomness!'
=== Trying smtp.mailgun.org:25...
=== Connected to smtp.mailgun.org.
<- 220 Mailgun Influx ready
-> EHLO ip-...
<- 250-AUTH PLAIN LOGIN
<- 250-SIZE 52428800
<- 250 STARTTLS
-> AUTH LOGIN
<- 334 VXNlcm5hbWU6
<- 334 UGFzc3dvcmQ6
<- 235 Authentication successful
-> MAIL FROM:<bitnami@ip...>
<- 250 Sender address accepted
-> RCPT TO:<rei...@gmail.com>
<- 250 Recipient address accepted
<- 354 Continue
-> Date: Mon, 20 Mar 2023 17:56:32 +0000
-> To: rei...@gmail.com
-> From: bitnami@ip...
-> Subject: Hello
-> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/
-> Testing some Mailgun awesomness!
<- 250 Great success
<- 221 See you later. Yours truly, Mailgun
=== Connection closed with remote host.
Add the following after
Yup, I saw that suggestion about adding “requireTLS” from your previous post (Unable to set up Mailgun).
I’ve run my config through the linter (https://jsonlint.com/) just in case I’ve overlooked some kind of formatting error.
I’ve tried different ports (25, 587, 465), quoted and unquoted.
"from": "reTHINK HOA BLOG <firstname.lastname@example.org>",
I’m a little bit confused why outlook is mentioned in the error message. My account I’m using with mailgun is an outlook email. I’ve set up DNS entries in Amazon Route 53 and the Mailgun confirms the configuration with the green check.
Error sending email! Error sending email: Failed to send email. Reason: Invalid login: 535 5.7.139 Authentication unsuccessful, the user credentials were incorrect. [MW4PR02CA0023.namprd02.prod.outlook.com 2023-03-20T18:40:54.621Z 08DB27FEA98F708E]. Please check your email settings and resend the invitation.
This is incorrect; it should be your domain.
Ooooh! I was so excited…but that was one of the remnants of trying out different things. I tried to see if I could get it to work with the sandbox email and forgot to change it back.
But it’s back to email@example.com.
Ugh…I’m so frustrated. I feel like I tried every combination except the correct one!
I’ve also made sure that SMTP is enabled from my email address, but I don’t know why this would matter since I’m using mailgun/aws.
Looking at your DNS, everything looks good, albeit you don’t have an SPF record for the bare domain. The authentication error from outlook.com makes no sense if you’re using MX records for mg.rethinkhoa.com.
config,production.json in its entirety, obfuscating any passwords etc., and make no changes to the file until I come back to you.
Thank you for your help, @mjw.
I think I need to take a 2 hour break since I’m running up against the account lock now and I’m running out of email addresses to test with.
Attached is the screenshot with the config. Hah! I promise to not make changes until you respond.
Ghost newsletter entries
Route 53 DNS entries
Mailgun domain settings
Well, I’m struggling to see anything wrong with your setup, especially since Swaks works for you. Did you restart Ghost (
ghost restart) after making config changes?
Hey there. I have run into the same problem seemingly. I’ve read all posts containing the error messages I’m receiving and none of them have provided any solution.
I just edited this post to give a lot of details. For anyone that comes here after this edit:
Ensure that you have the correct SMTP address in your config.production.json.
I had changed it to smtp.mailgun.com and that failed my authentication attempts for good reason. The address I’ve setup in Mailgun is smtp.eu.mailgun.com. Notice that eu.-addition? That’s the solution for me.