# Ar\_sendmail is not sending email from the email table with ARMailer

**URL:** <https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535>\
**Category:** Rails\
**Created:** [July 8, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535 "2008-07-08T23:43:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 8, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/1 "2008-07-08T23:43:11Z")

</div>

I am using the ar\_mailer gem. I have been able to get emails into my  
newly created emails table, but when I run ar\_sendmail to actually  
send the messages from the table, absolutely nothing happens. I run  
“ar\_sendmail” from my app’s root directory, and it hangs for a few  
seconds, like it is processing something, then the prompt comes back  
as it has finished. But all the emails are still queued up in the  
emails table. Nothing was actually sent, and there are no errors  
thrown. I tried running ar\_sendmail with some options, such  
as …ar\_sendmail -d --batch-size 4 --delay 60 --environment  
production, but that produced the same result.

My environment.rb file has the correct require: require  
‘action\_mailer/ar\_mailer’

My production.rb file looks like:  
ActionMailer::Base.smtp\_settings = {  
:address =\> “localhost”,  
:port =\> 25,  
:domain =\> ‘[domain.com](http://domain.com)’  
}  
ActionMailer::Base.perform\_deliveries = true  
ActionMailer::Base.delivery\_method = :activerecord  
ActionMailer::Base.raise\_delivery\_errors = false  
ActionMailer::Base.default\_charset = “utf-8”  
ActionMailer::Base.default\_content\_type = “text/html”

Has anyone else experienced this? Am I missing something else? Is  
there a way I can see some debug from ar\_sendmail to find out what is  
going on in those few seconds that it seems to be doing something?

Thanks in advance!  
LAB

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 9, 2008, 12:03am UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/2 "2008-07-09T00:03:25Z")

</div>

What does your production.log say?

- Richard

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 9, 2008, 12:08am UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/3 "2008-07-09T00:08:42Z")

</div>

I can see where the email template is used in the production.log file,  
and those emails are being added to the emails table properly. When I  
do a “ar\_sendmail”, to actually send the messages, I get absolutely no  
output to the production.log, like it is not even hitting it.

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 9, 2008, 12:30am UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/4 "2008-07-09T00:30:56Z")

</div>

Maybe the --environment arg isnt working properly, check the  
development log to see if its defaulting to that.

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 9, 2008, 1:09am UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/5 "2008-07-09T01:09:22Z")

</div>

Thanks for the quick replies! There is no output to the  
development.log either. The interesting thing is, if I do a  
“ar\_sendmail --mailq”, it prints out the 3 entries I have in the  
emails table. So it is connecting to the right table and reading the  
data from it. I tried a “ar\_sendmail -v” to get the verbose output,  
and it says “found 3 messages to send” and then just quits.

Any other ideas?

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 9, 2008, 1:22am UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/6 "2008-07-09T01:22:58Z")

</div>

Maybe this is a silly question to ask, has your smtp ever performed  
successfully in the past?  
If not, perhaps check to make sure the smtp traffic is not blocked. I  
had this experience where my rails smtp traffic was quietly blocked by  
the corporate firewall and I just couldn’t figure out why the mail  
wasn’t going out. I had no error message in my log as well. I  
eventually found out about the firewall block.

Just a thought.

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 10, 2008, 11:25pm UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/7 "2008-07-10T23:25:31Z")

</div>

Make sure you have SMTP server running on your box. ar\_sendmail needs to  
deleiver email to SMTP server of some sort. To test try

telnet localhost 25

on Mac you would start SMTP server as “sudo postfix start”, on Ubuntu:  
“sudo /etc/init.d/postfix start”

Once your SMTP server is running you will be able to tail the logs and  
fix the problem: tail -f /var/log/mail.log

---

<div class="post-metadata">

**Author:** ![LAB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@LAB](https://www.ruby-forum.com/u/LAB)\
**Post date:** [July 9, 2008, 2:12am UTC](https://www.ruby-forum.com/t/ar-sendmail-is-not-sending-email-from-the-email-table-with-armailer/142535/8 "2008-07-09T02:12:51Z")

</div>

Hmmm … a good thought, but when I look at the emails table, the  
column for “last\_send\_attempt” is 0 for all my entries. So wouldn’t  
that get incremented if it was actually sending the email, but getting  
blocked down the line? It seems like it is not even trying to send  
the messages, because the last\_send\_attempt is never changed.

Thanks for any help!
