Note that there are some explanatory texts on larger screens.

plurals
  1. POSending mail with devise and Gmail smtp server
    text
    copied!<p>I am using Devise :confirmable and :recoverable module to confirm a user and to let him recover his password if he forgets it. Everything is going fine, the mail gets generated and I can see it in the server log, but then I am facing errors and the mail is not delivered to the mailbox. The SMTP settings for my environment.rb file is :</p> <pre><code>require 'tlsmail' Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.perform_deliveries = true ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :enable_starttls_auto =&gt; true, #this is the important shit! :address =&gt; 'smtp.gmail.com', #'localhost', :port =&gt; 587, :tls =&gt; true, :domain =&gt; 'mail.google.com', # mail.customdomain.com if you use google apps :authentication =&gt; :login, :user_name =&gt; 'jatinkumar.nitk@gmail.com', :password =&gt; '_secret_password' } </code></pre> <p>If the :address is 'smtp.gmail.com' , then i get the following error:</p> <pre><code>SocketError (getaddrinfo: Name or service not known): </code></pre> <p>If i set the :address to 'localhost', then i get the following error:</p> <pre><code>Errno::ECONNREFUSED Connection refused - connect(2) </code></pre> <p>I don't know what this :address means, a newbie for all this stuff. On running <strong>uname -a</strong>, i get</p> <pre><code>Linux jatin-ubuntu 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 i686 GNU/Linux </code></pre> <p>In my <strong>/etc/hosts</strong> file the entries are :</p> <pre><code>127.0.0.1 localhost 127.0.1.1 jatin-ubuntu *#74.125.93.109 smtp.gmail.com #The above entry added by me* # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts </code></pre> <p>When I uncomment the 'smtp.gmail.com' address in the /etc/hosts file, the following error is gone :</p> <pre><code>SocketError (getaddrinfo: Name or service not known): </code></pre> <p>and now the error is :</p> <pre><code>Errno::ECONNREFUSED Connection refused - connect(2) </code></pre> <p>I don't know what is going wrong, googled for the errors and tried everything but nothing came to rescue. I do have the <strong>'tlsmail'</strong> gem installed and the <strong>'mail'</strong> gem as well, and my application is in development mode. Help me fix this error so that i can happily continue my rails journey and if possible guide me a little over this :address issue in the right direction so that i understand the basics of this. Thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload