SSL Error when sending email via amazon-ses-mailer gem - ruby-on-rails

I found this post Using Amazon SES with Rails ActionMailer and followed the examples found on https://github.com/abronte/Amazon-SES-Mailer but I'm getting this error when sending the mail
"SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"
config/environments/development.rb:
config.action_mailer.delivery_method = AmazonSes::Mailer.new(
:secret_key => 'AKIAJ*******',
:access_key => 'Ahs08*********'
)
sending message:
mailer = ActionMailer::Base.delivery_method = AmazonSes::Mailer.new(
:secret_key => 'AKI*******',
:access_key => 'Ah***********'
)
mailer.deliver( UserMailer.test(#this_user.email).encoded )
Why am I having SSL Errors here? I tried another configuration using smtp with personal gmail account and its sending the email just fine. Is it a problem with SES? How do I fix this?

I don't think you need the SES Mailer gem anymore. SES used to support TLS wrappers only but as of March 7th 2012...
Amazon SES now supports STARTTLS
As stated in an answer at this SO question. It should be as simple as...
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "email-smtp.us-east-1.amazonaws.com",
:user_name => "..." # Your SMTP user here.
:password => "...", # Your SMTP password here.
:authentication => :login,
:enable_starttls_auto => true
}

Related

Zoho ActionMailer Rails 5.0.1

What configuration do I need to send email from a rails application with Zoho?
With this configuration:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => 'smtp.zoho.com',
:port => 465,
:user_name => ENV['NOREPLY_USERNAME'],
:password => ENV['NOREPLY_PASSWORD'],
:authentication => :login,
:ssl => true,
:tls => true,
:enable_starttls_auto => true
}
I get this error:
Net::SMTPAuthenticationError (535 Authentication Failed):
With the same configuration but port 587 instead I get this error:
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=unknown state: unknown protocol):
I have made sure that NOREPLY_USERNAME and NOREPLY_PASSWORD are the correct values.
Any help would be appreciated.
Emailed Zoho about this and they told me they checked and my email was hosted in Europe, so they told me to change to smtp.zoho.eu and use 465 SSL or 587 TLS. smtp.zoho.eu worked with 465 SSL and there are no errors and the emails are sent successfully.

Rails 3.2 email sent via smtp is flagged as unencrypted by gmail

I would like to ask what I missed why my email was flagged as unencrypted by Gmail. My project uses Hostmonster.com no-reply account to send email.
Rails smtp settings:
config.action_mailer.default_url_options = { host: APP_CONFIG[:host], port: APP_CONFIG[:port], protocol: "https" }
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "host289.hostmonster.com",
:port => 465,
:domain => APP_CONFIG[:smtp][:domain],
:user_name => APP_CONFIG[:smtp][:user_name],
:password => APP_CONFIG[:smtp][:password],
:authentication => "plain",
:enable_starttls_auto => true,
:ssl => true
}
Hostmonster cpanel:
enter image description here
The project is already in HTTPS. I don't know if it's in my end causing the Gmail unencrypted issues or on hostmonster.
enter image description here
I believe this is rather about the configuration of the hosting SMTP server when talking to GMail servers. You are sending your email to the hostmonster SMTP server via encrypted SMTP connection, which is correct. But it's the hostmonster's responsibility to also send the mail encrypted further on, which they probably don't do.
I would contact the hostmonster's support about this issue, i.e. ask them if they use encrypted communication when sending outgoing emails from their servers.

ArgumentError: SMTP-AUTH requested but missing user name + ActionMailer

I m not able to sent mail using actionmailer everytime I try to deliver the mail using actionmailer It report me with error
ArgumentError: SMTP-AUTH requested but missing user name
This is Strange as I'm able to sent mail via Telnet but not using ActionMailer
Attaching Telnet Screenshot
Here my SMTP settings
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => '216.224.183.100',
:port => 25,
:domain => '[domain_name]',
:username => "[username]",
:password => "[password]",
:authentication => 'plain',
:enable_starttls_auto => true
}
Can anyone Please tell as to via the Mail is not getting sent
Got it. It's user_name, and not username.

What is wrong with my Rails SMTP config?

I was given this smtp server address: klee.cdlib.org (behind our firewall and does not need password/login) and my own local address where my dev application is running is http://128.48.204.195:3000
Here are my current configurations in the development.rb file:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "klee.cdlib.org",
:port => 587,
:domain => 'klee.cdlib.org', #'http://128.48.204.195:3000',
# :user_name => '',
# :password => '',
:authentication => 'plain',
:enable_starttls_auto => true }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
This gives an error:
Net::SMTPFatalError (550 5.7.1 <my#email.com>... Relaying denied
I am also not sure about the difference between domain and address fields. What should be in which? :) And what else am I possibly doing wrong to get this error?
Thanks,
Alex
Your rails setup seems ok. Denied relaying is probably raised because the mail server actually does not allow relaying any mails for mails from 128.48.204.195. It's possible that the mail server configuration is not configured for that or perhaps it's configured to relay mails from klee.cdlib.org which has no reverse DNS entry.

Rails Action Mailer TLS Certificate Issues

I am trying to use rackspace ssl smtp for my mail settings for our rails application and I am receiving this error
hostname was not match with the server certificate
I need to find a way to disable verify on the certs for ActionMailer.
Anyone know how to do this?
Try setting enable_starttls_auto to false in your smtp_settings:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = "utf-8"
ActionMailer::Base.smtp_settings = {
:address => 'server.com',
:port => '25',
:domain => 'yourdomain.com',
:user_name => 'username',
:password => 'password',
:authentication => :login,
:enable_starttls_auto => false
}
For some reason I can't comment on Derek's answer, but his answer does in fact work now with Rackspace. Simply changing tls to false now works great.
Resolved issue by using sendmail and configuring sendmail to use the proper smtp settings required to use rackspace email hosting.

Resources