Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 mailer not working and not logging any errors
    text
    copied!<p>I have tried all kinds of configurations but still I can't send an email in my development environment from rails.</p> <p>I installed mailutils to try this from the command line and it worked, I received the email (in spam of course): echo test | mail -s Subject user@example.com</p> <p>Here's my config:</p> <pre><code># Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = true # still no logs about emails config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries = true # I can't believe I have to add this option. Does it even exist? I found it on google. config.action_mailer.smtp_settings = { :enable_starttls_auto =&gt; true, :address =&gt; "smtp.gmail.com", :port =&gt; 587, :domain =&gt; "gmail.com", :authentication =&gt; :login, :user_name =&gt; "some_user@gmail.com", :password =&gt; "abc123", } </code></pre> <p>And here's the code in the mailer:</p> <pre><code>class UserMailer &lt; ActionMailer::Base default :from =&gt; "root@ubuntu" def test_email Rails.logger.debug 'test_email' mail(:to =&gt; 'user@example.com', :subject =&gt; "testing rails") end end </code></pre> <p>The controller:</p> <pre><code>class PagesController &lt; ApplicationController def home UserMailer.test_email end end </code></pre> <p>development.log:</p> <pre><code>[2012-03-01 18:26:45.859] DEBUG [bb44dee806d73eb60ab3ae16297f5c02] [127.0.0.1] [GET] [http://myapp:3000/] test_email [2012-03-01 18:26:45.888] INFO [bb44dee806d73eb60ab3ae16297f5c02] [127.0.0.1] [GET] [http://myapp:3000/] Rendered user_mailer/test_email (1.6ms) [2012-03-01 18:26:45.898] INFO [bb44dee806d73eb60ab3ae16297f5c02] [127.0.0.1] [GET] [http://myapp:3000/] Rendered pages/home.html.erb within layouts/application (1.1ms) [2012-03-01 18:26:46.815] INFO [bb44dee806d73eb60ab3ae16297f5c02] [127.0.0.1] [GET] [http://myapp:3000/] Completed 200 OK in 455ms (Views: 112.4ms) </code></pre> <p>I also tried using the console:</p> <pre><code>root@ubuntu:/srv/www/myapp# rails c Loading development environment (Rails 3.2.1) irb(main):001:0&gt; UserMailer.test_email =&gt; #&lt;Mail::Message:32110400, Multipart: false, Headers: &lt;To: user@example.com&gt;, &lt;Subject: testing rails&gt;, &lt;Mime-Version: 1.0&gt;, &lt;Content-Type: text/html&gt;&gt; </code></pre>
 

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