Cannot send out email using ar_mailer plug in

Forums > Book - Chapter 8 > Cannot send out email using ar_mailer plug in

Login to post a new topic

Author Message
u196598
Member since 10 Mar 19:08
0 posts

I am using gmail SMTP server to send out email from my application. I am following the instructions from following link and everything is fine. I can send out email whenever a new comment is added.


http://www.railsforum.com/viewtopic.php?pid=55521


When trying to build newsletter feature, I am following book’s instructions. but after these changes, I cannot send out email anymore when adding a new comment. Changes are listed below:
1. install ar_mailer plugin
2. create Email model and emails table:
3. change Notifier class:
#class Notifier < ActionMailer::Base
class Notifier < ActionMailer::ARMailer
...
4. change gmail STMP settings and add ar_mailer in environment.rb file:
#ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.delivery_method = :activerecord
ActionMailer::Base.smtp_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:domain => “mycompany.com”,
:authentication => :plain,
:user_name => “mygmail@gmail.com”,
:password => “fdaspace”
}
require ‘action_mailer/ar_mailer’



After these changes, I restarted the server and tried to add new comments. Everything looks fine without any errors but I cannot send out email anymore.
I checked table emails. whenever adding a new comment, a new record will be added to this table. For example, following is one record data:


id: 9
from: ‘system@railscoders.net’
to: ‘baqig_wang@hotmail.com’
last_send_attempt: 0
mail: ‘From: RailsCoders
To: bwang
Subject: A new comment has been left on your blog
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_47f996ee21728_a782356db0291
—mimepart_47f996ee21728_a782356db0291
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline
Hi bwang,
A new comment has been left on your blog at RailsCoders.net.
The comment was left by ‘Admin’ at =
06 Apr 23:37.
To read the comment, go to http://localhost:3000/users/2/entries/10
Cheers,
The RailsCoders Team
—mimepart_47f996ee21728_a782356db0291
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline
3D"RailsCoders">

Hi bwang,


A new comment has been left on your blog at RailsCoders.


The comment was left by Admi=
n
on 06 Apr 23:37


To read the comment, go to tries/10”>http://localhost:3000/users/2/entries/10


Cheers,

The RailsCoders Team


-mimepart_47f996ee21728_a782356db0291-


Did anybody experience the same problem before?


Thanks a lot,


Brian

u196598
Member since 10 Mar 19:08
0 posts

The problem was fixed:
1. add created_on column to emails table.
2. run ar_sendmail