ar_sendmail is not sending email from the email table with ARMailer

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 => '' } 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

What does your production.log say? - Richard

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.

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

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?

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.

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!

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