I have configured Mastodon to send emails via the Gmail SMTP Server (not actually Gmail but G apps)
But Actionmailer fails to send it and I get this as answer: "End of file reached". And the Email is not sent. (no error on the GUI either, just in the docker log)
Google tells me this is what happens when the smtp server is down which it isn't.
This is in my .env.production

I have read some error with mastodon containing "+" in email adresses which might be a problem. I don't have that but could it be the username which includes the "@" as gmail authenticates for whole domains?
鉁旓笍 Making sure the credentials are correct
鉁旓笍 Making sure other services can connect with these credentials
鉁旓笍Updating and rebuilding
鉁旓笍Installing the same setup on a different server (not even the same country)
Nothing worked so far
I'm seeing a similar error in my logs, though my emails _are_ being sent. Could there be an unrelated configuration issue?
I'm seeing the same error in my logs and emails _are not_ being sent. I'm using Mailgun.
@ashfurrow I'm a fraid not, I even checked the low-level logs on admin.google.com for my google apps domain but no connection was ever made.
Do you use the gmail SMTP too?
Gotcha. I'm using Mailgun actually.
@ashfurrow Any tips? I'm running similar to the way your instance is set up (Heroku, Mailgun, etc.), but it's not sending email. It doesn't look like it's sending to Mailgun, so I don't think the issue is with my Mailgun config but somewhere else.
Mailgun documentation said it accepted a number of different ports, but I had to use 25 to get it to work. I assumed it was a Heroku thing. I also could not use the default Mailgun SMTP credentials (postmaster@) but rather had to create my own. Good luck, let us know when you've figured out the issue!
Alright so it has something todo with the TLS connection. Port 25 is not available for Google :/
Have you managed to make it work ? I had the same issue. I changed "smtp" to "sendmail" in my production.rb file, now i don't have any error(s) anymore, it print that it works, BUT, i'm not receiving the email :/
I'm using Gmail too, but a standard account.
I'm afraid not, @Zyrophr Waiting for a fix myself
@chrisiaut Well, I also tried Hotmail, GMX, and now Gmail... Same bug :/
@Zyrophr yes I have the impression this bug always happens when your SMTP has to authenticate you with your full email. I have a feeling that the "@" is responsible. Will test with local SMTP today
@chrisiaut If you achieve something, if it works, could you please notify me ? That would be nice, i'm like dying of this... Here is my mastodon account in case you need it : https://mastodon.cx/@Zyrophr
Hmm... If local SMTP works, i'll have to learn how to host something like that :(
Well, thanks in advance !
I had a similar problem - no confirmation emails being sent but all settings seem OK. Local SMTP as well as SparkPost SMTP. Then I added SMTP_DOMAIN=(my server hostname) to .env.production and everything now works.
Also having issues with email not being sent out with a fresh instance. SMTP_DOMAIN fix didn't work for me but I may not know how to restart my service properly (I ran systemctl restart <all the services>). My .env.production:
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=<x>
[email protected]
SMTP_DOMAIN=creativity.cafe
Whoops... going to reset that password ;)
Looks like the issue is that OpenSSL isn't working through my web mailer for some reason:
[ActiveJob] [ActionMailer::DeliveryJob] [b7341252-9045-4d75-b3cf-29ef9138da6b] Performed ActionMailer::DeliveryJob from Sidekiq(mailers) in 54.78ms
Apr 11 05:54:34 ubuntu-mstdn-seeker bundle[489]: 2017-04-11T05:54:34.254Z 489 TID-gt4l1q2r4 ActionMailer::DeliveryJob JID-0862836595c82a7f01d5f366 INFO: fail: 0.059 sec
Apr 11 05:54:34 ubuntu-mstdn-seeker bundle[489]: 2017-04-11T05:54:34.258Z 489 TID-gt4l1q2r4 WARN: {"context":"Job raised exception","job":{"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","w
Apr 11 05:54:34 ubuntu-mstdn-seeker bundle[489]: 2017-04-11T05:54:34.258Z 489 TID-gt4l1q2r4 WARN: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
Apr 11 05:54:34 ubuntu-mstdn-seeker bundle[489]: 2017-04-11T05:54:34.258Z 489 TID-gt4l1q2r4 WARN: /home/mastodon/.rbenv/versions/2.4.1/lib/ruby/2.4.0/net/protocol.rb:44:in `connect_nonblock'
I was able to get email to send in my case by setting SMTP_OPENSSL_VERIFY_MODE=none. Unsure if this is a security hole or not, though.
Awesome, thanks! It works now for me with Google.
My .env.production:
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=mypassword
[email protected]
SMTP_DOMAIN=myinstance.at
SMTP_OPENSSL_VERIFY_MODE=none
@Zyrophr
Hi...
I have being trying for a while with no success sending initial email from mastodon . Here is my config which seems to be working just fine.
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=mypassword
[email protected]
SMTP_DOMAIN=tatu.la
SMTP_OPENSSL_VERIFY_MODE=none
Also a command line test using mailgun API works fine (curl... example taken from mailgun help) Any hint please? thanks
@javigf Hmm. Your SMTP_LOGIN should be the address from Mailgun. Check out your domain settings, then "manage SMTP credentials". Create a new one, like [email protected] and use that address and the password they give you for the SMTP_LOGIN and SMTP_PASSWORD fields. That should do it 馃憤
Note: I had in my config SMTP_DELIVERY_METHOD=smtp # can also be sendmail which was causing issues. It should instead be SMTP_DELIVERY_METHOD=smtp without the trailing comment.
Nice catch!
IT Worked !!! Awesome. thanks a lot.
you were right. Sending my current config so anyone can see and might help others
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=mypassword
[email protected]
SMTP_DOMAIN=tatu.la
SMTP_OPENSSL_VERIFY_MODE=none
Great!
I have the same problem but not soloved
OS: Ubuntu 16.04 64bit
IPv6: disabled
Network tested, I can reach port 587, 25, 2525, etc.
RBL/SBL tested, no blacklist IPs
I use mailgun and I read every issues about the question
Here is my config
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=<hidden>
[email protected]
SMTP_DOMAIN=mail.example.com
SMTP_DELIVERY_METHOD=smtp
SMTP_AUTH_METHOD=plain
SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_ENABLE_STARTTLS_AUTO=true
Here is log from docker
[acf94ddf-50c9-4ccd-a8c9-0375a3d0acef] [ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: e6b83b45-7dcc-403b-870a-e336ae276bb6) to Sidekiq(mailers) with arguments: "UserMailer", "reset_password_instructions", "deliver_now", #<GlobalID:0x0055c848b465e8 @uri=#<URI::GID gid://mastodon/User/1>>, "PefEepTRJBksye2mUEzK", {}
But no emails were sent, no logs in Mailgun
Soloved, after changing .env.production
We should use
docker-compose up -d
docker-compose restart
to re-build docker container
Google users I had to turn off mandatory ssl connections for this to work, you will get an email in the domains address after a mail attempt failed.
I wonder though if someone could make it work with an ssl connections, because this is a bit bad.
In my case the issue was is sitting in middle proxy which blocks smtp.
Some tips about diagnose: https://stackoverflow.com/a/64560726/983232