"Have nothing in your houses that you do not know to be useful or believe to be beautiful." - William Morris

Rails: Action Mailer ‘302 found’ error

Posted: August 21st, 2007 | Author: | Filed under: Technology | Tags: , , | No Comments »

I’ve just been banging my head against an issue with my Rails Action Mailer (action_mailer) not sending emails. I know the application used to work, but thought the upgrade to the latest Rails had scuppered it. Every time I’d try and send an email the server console churns and then simply says: 302 Found.

So I turned on the full debugging in my config file (config.action_mailer.raise_delivery_errors = true) and this meant I got a time out error shown. Pinging my mail server gave a rapid response, so that was obviously not the problem.

Turned out it was simply that my local host blocks port 25, the standard SMTP port – forcing you to use their local SMTP for all outbound mail. Simple. I used this handy guide to connecting to SMTP from the command line over Telnet to help identify that port 25 was blocked. [ADDENDUM: If you need to authorize yourself on your telnet server then read this to find out how, and this to learn about base 64 encoding on the command line].

Luckily my host provides an alternate SMTP port number for just such an eventuality, but otherwise it means you have to set up your local development SMTP to match your local ISP information.



Leave a Reply

You must be logged in to post a comment.