Unable Send Email through SMTP


#1

Hello All,

i have this configuration in development.rb

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
address: “smtp.gmail.com”,
port: 587,
domain: “gmail.com”,
authentication: “plain”,
enable_starttls_auto: true,
user_name: emailid,
password: password,
ssl: true
}
config.action_mailer.perform_deliveries = true

Using Rails 4 and ruby 2 versions, emails are not getting delivered
though
in the console it shows as below
Sent mail to emailid (30012.9ms)
Date: Thu, 23 Apr 2015 15:40:29 +0530
From: removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Message-ID: removed_email_address@domain.invalid
Subject: SMT
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi This a mail regarding the cell rotation

and Error outs as

Net::OpenTimeout (execution expired):


#2

Whom are you sending email to? Because which service you connect to,
and how, affects how Gmail restricts the recipients.

Make sure you’re lined up fully with,
https://support.google.com/a/answer/176600?hl=en

Specifically you may need to be using, smtp-relay.gmail.com

HTH,
Paul


#3

Here’s the Environment Devise configuration.

Devise configuration settings

config.action_mailer.default_url_options = { :host => ‘your host
port’}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true


#4

Are you using an ordinary gmail account or a domain account hosted on
Google Apps? For the former, you can turn on “Access for less secure
apps”
in the account settings. If you’re using the latter, you must use SSL.
I’m
not sure your port is correct. The following is a working configuration
using a domain account hosted on Google Apps.

ActionMailer::Base.smtp_settings = { :address =>
smtp.gmail.com’,
:port => ‘465’, :authentication => ‘plain’, :user_name
=> ‘removed_email_address@domain.invalid’, :password => ‘yourpassword’, :domain
=> ‘removed_email_address@domain.invalid’, :ssl => true }


#5

1.) Check whether the mail id your using has two step verifiication if
so
change it.
2.) Check whether port 587 has been added in the IPtables if not add it
using below command.
iptables -I INPUT -p tcp --dport 22 -j ACCEPT


#6

Hello,

@paul , @cody

Thank you for the reply, I used ordinary gmail account, I did work
around
your solutions but no luck… the error “Net::OpenTimeout (execution
expired):
.” stopped appearing, but mails were not delivered.