Error setting up Redmine outgoing email - ruby-on-rails

I am unable to setup email notifications on Redmine 1.0.3. I get following error when I ry sending a test mail:
An error occurred while sending mail (getaddrinfo: The storage control blocks were destroyed. )
My email.yml is as follows
production:
delivery_method: :smtp
smtp_settings:
tls: true
enable_starttls_auto: true
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: mymail#mydomain.com
password: PASSWORD
Will appreciate any help on this.

Download following plugin and install it.
https://github.com/collectiveidea/action_mailer_optional_tls
It will help you to resolve the issue.

Related

smtp configuration for custom gmail address

For my rails application, i have configured my gmail address as a gateway to send emails, i did this and it was working fine (normal gmail) :
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: 'example#gmail.com',
password: 'password',
authentication: 'plain',
enable_starttls_auto: true }
But today, i created a custom email in gmail (contact#mydomain.ma).
So i did the same configuration beside confirming that the domain is mine:
1 - Enable Forwarding and POP/IMAP
2 - Enable access of less secure apps
and for the rails configuration, i did the following:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'mydomain.ma',
user_name: 'contact#mydomain.ma',
password: 'password',
authentication: 'plain',
enable_starttls_auto: true }
Infortunately, i get this error :
Net::SMTPAuthenticationError at /fr/emails
534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtx
I'm sure that the error cames from the rails configuration, any help?
Thanks!
Not sure for port, but AFAIR gmail uses 465 SSL port. Have you tried port 465?
Also check this article http://docs.helpscout.net/article/120-smtp-settings
There's info that sometimes google treats some apps for 'less secure' and requires more setup.
I've put in my credentials correctly, but I keep receiving a 5.7.14
error when I test the connection. Help! This means Gmail is trying to
properly authenticate your credentials through Help Scout. In some
cases, you have to ask Gmail to allow less secure apps in order for
this to do the trick. If it's still acting wonky, head over to this
link, follow the instructions, and then head back into Help Scout and
retry the Test Connection button in your connection settings.
Check this links:
https://support.google.com/accounts/answer/6010255?hl=en
https://accounts.google.com/b/0/DisplayUnlockCaptcha
Hope this helps.

OpenSSL::SSL::SSLError (hostname "smtp.mandrillapp.com" does not match the server certificate)

Since migrating a production Rails app to a new machine, the follow error is always recieved when trying to send mail via Mandrill:
OpenSSL::SSL::SSLError (hostname "smtp.mandrillapp.com" does not match the server certificate)
Here is the
config.action_mailer.smtp_settings = {
address: 'smtp.mandrillapp.com',
port: '587',
enable_starttls_auto: true,
user_name: 'XXXXXXXX',
password: 'XXXXXXXX',
authentication: 'login', # Mandrill supports 'plain' or 'login'
domain: 'mydomain.com' }
Mandrill down not allow for openssl_verify_mode: 'none' as suggested here: Rails 3: OpenSSL::SSL::SSLError: hostname was not match with the server certificate
When openssl_verify_mode: 'none' is set the error becomes:
Net::SMTPAuthenticationError (535 Incorrect authentication data)
Any ideas on how to correct this?
I encountered and solved this issue (my Rails app is hosted on a WHM/cPanel account).
The trick was tweaking the SMTP Restrictions in the WHM settings, specifically turning off the following setting:
"Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)"

Rails mailer smtp configuration with gmail

So I am having trouble setting up this rails application(OpenProject, if it makes a difference).
When I try the send a test mail in the openproject settings it displays a message in that the e-mail was sent but I don’t ever receive it at the address.
config/configuration.yml
production:
delivery_method: :smtp
smtp_settings:
tls: true
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email#gmail.com"
password: "your_password"
development:
delivery_method: :smtp
smtp_settings:
tls: true
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email#gmail.com"
password: "your_password"
test:
delivery_method: :test
If I use:
telnet smtp.gmail.com 587
Trying 64.233.171.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP r1sm2094806qam.42 – gsmtp
This leads me to think I can send to gmail but I cant receive from gmail. I have also tried all of the configurations such as port 25 and 456 as well as with SSL vs TLS and none. so I don't think it is just my ISP blocking the mail.
In my google settings → accounts and Import → add another email address you own
Send mail through your SMTP server.
SMTP server: smtp.my_domain_name.com
Port: 587
Username: my_username_on_my_domain
Password: passwd
TLS (recommended) ← (I have this selected)
SSL
I get the message
Couldn't reach server. Please double-check the server and port number.
I did run
netstat -a
If the results of that would be helpful let me know.
Any help would be greatly appreciated. Thanks.
Unfortunately there is no any logs in your question. Please note:
Gmail Api Do not support sent email from different adress(protect from spam/spoof)
Rails can send email from self application and this options tell him what host use.
Consider config.action_mailer.raise_delivery_errors = true to debug your code and settins.

Sending mail using Mandrill smtp on rails app

I'm hosting a rails app on my own server using Unicorn and Nginx. I have an issue when i try to send mails using mandrill, i get the following error :
Net::SMTPServerBusy: 401 Syntax: HELO hostname
And this is my configuration on production.rb:
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default charset: 'utf-8'
config.action_mailer.smtp_settings = {
address: 'smtp.mandrillapp.com',
port: 587,
authentication: "plain",
domain: localhost,
enable_starttls_auto: true,
user_name: ENV['MANDRILL_USERNAME'],
password: ENV['MANDRILL_API_KEY']
}
what i get from the error is that maybe mandrill reject the domain because is not "safe/registered"??
I already tried changing the domain to 'timewarp.us' (yet not registered), and i'm having the same problem.
If i change madrill and use the gmail smtp it works as expected.
This is the first time i'm doing a deploy to a server and i'm kinda lost.
Any help would be great. Thanks!
Try adding your actual domain instead of localhost. My guess is that Mandrill won't accept localhost as a hostname.

ActionMailer 3.2.x OpenSSL::SSL::SSLError

I used my Rails app to Rails 3.2.8 and found that my SMTP outgoing mail was no longer able to authenticate with my mail server.
Further investigation revealed that my ActionMailer config was using following:
config.action_mailer.smtp_settings = { address: 'mail.mydomain.us',
port: 587,
domain: 'mydomain.us',
user_name: 'xxx#mydomain.us',
password: 'yyy',
authentication: 'login',
openssl_verify_mode: 'none',
enable_starttls_auto: true,
ssl: true }
The specific error message I was seeing was:
SSL_connect returned=1 errno=0 state=unknown state: unknown protocol
Hope this helps somebody.
I also ran into this issue, and I found a couple of things on SendGrids site.
Here is the recommend setup which uses tls and not ssl
http://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.html
If you want to use SSL you should be using port 465
Here are the recommended ports:
http://sendgrid.com/docs/User_Guide/smtp_ports.html

Resources