ActionMailer Fails To Send Emails Post Authentication

I am trying to send emails via actionmailer.

It was working fine before and now suddenly what was working is no
longer working!

I have one version of the application running in production and whenever
I try to run it in production I get the error No connection could be
made because the target machine actively refused it. - connect(2) (see
details in the attached text file)

Now when I try to run the same application on the local machine (Dev)
with a local mail server running on it I get the error :

Net::SMTPAuthenticationError in AccessrequestsController#create
535 Authentication Failed (see details in the text file attached).

The actionmailer settings for production are :
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 25,
:domain => "letter4sure.com",
:authentication => :login,
:user_name => "CHECKED_THIS_ADMIN_USER/PWD_IT_WORKS",
:password => "CHECKED_THIS_ADMIN_USER/PWD_IT_WORKS"
}

For the local machine it is :

ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 25,
:domain => "localhost",
:authentication => :login,
:user_name => "CHECKED_THIS_ADMIN_USER/PWD_IT_WORKS",
:password => "CHECKED_THIS_ADMIN_USER/PWD_IT_WORKS"
}

When I remove all authentication user name and password information I
can send emails beautifully but that is BAD! because my mail server
could be used as a relaying station. That is unacceptable.
So help would be appreciated in deciphering the mysteries of
ActionMailer please.

Ok I figured out the problem or atleast I think I did. I have to create
a separate account with user and password (NOT admin) that can send
emails. then the following works ... atleast for now.

Ather Shiraz wrote: