I have the following setup: Ubuntu Ruby on Rails on 14.04 (Nginx + Unicorn) (London location)
I have manually upgraded it to Rails 4. The application is running fine, but I cannot send e-mails.
I have followed the tutorials on adding the Gmail MX records, the domain is pointed to the droplet, so everything is fine.
The account to send from is on Gmail.
Rails settings are the following:
config.action_mailer.smtp_settings = { address: “smtp.gmail.com”, port: 587, domain: “gmail.com”, authentication: :login, enable_starttls_auto: true, user_name: Rails.application.secrets.email_provider_username, password: Rails.application.secrets.email_provider_password } config.action_mailer.default_url_options = { :host => “smtp.gmail.com” } config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = false
By testing it on a local machine, the code itself can send e-mails using the same credentials both in development and in production mode, so not likely that it is the code.
I have also configured postfix on the server (although I am not sure if that was necessary), and could send a test e-mail from the command line.
Mails are still not working from Rails.
Any ideas where to look for the problem ???
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
default url is you domain
config.actionmailer.defaulturloptions = { :host => “domain.com” }
I actually figured this out.
I set this in production, to actually see the error: config.actionmailer.raisedelivery_errors = true
and it turned out that sending the email timed out, which after some research led me here: https://www.digitalocean.com/community/questions/outgoing-connections-on-port-25-587-143-blocked-over-ipv6
Just for reference for people with trouble getting email sending working that might reach this page in the future:
For some time now Digital Ocean droplets have SMTP traffic blocked by default (because of anti-spam regulations). If you need SMTP enabled on your droplet you have to issue a support ticket asking for it to be enabled.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.