# ActionMailer Fails To Send Emails Post Authentication

**URL:** <https://www.ruby-forum.com/t/actionmailer-fails-to-send-emails-post-authentication/141234>\
**Category:** Rails\
**Created:** [June 23, 2008, 10:30pm UTC](https://www.ruby-forum.com/t/actionmailer-fails-to-send-emails-post-authentication/141234 "2008-06-23T22:30:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ror\_arch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ror\_arch](https://www.ruby-forum.com/u/ror_arch)\
**Post date:** [June 23, 2008, 10:30pm UTC](https://www.ruby-forum.com/t/actionmailer-fails-to-send-emails-post-authentication/141234/1 "2008-06-23T22:30:17Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![ror\_arch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ror\_arch](https://www.ruby-forum.com/u/ror_arch)\
**Post date:** [June 24, 2008, 2:02am UTC](https://www.ruby-forum.com/t/actionmailer-fails-to-send-emails-post-authentication/141234/2 "2008-06-24T02:02:51Z")

</div>

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 S. wrote:

> I am trying to send emails via actionmailer.
> 
> It was working fine before and now suddenly what was working is no  
> longer working!
> 
> 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](http://letter4sure.com)”,  
> :authentication =\> :login,  
> :user\_name =\> “CHECKED\_THIS\_ADMIN\_USER/PWD\_IT\_WORKS”,  
> :password =\> “CHECKED\_THIS\_ADMIN\_USER/PWD\_IT\_WORKS”  
> }
