# Email issues

**URL:** <https://www.ruby-forum.com/t/email-issues/124103>\
**Category:** Rails\
**Created:** [December 24, 2007, 7:13pm UTC](https://www.ruby-forum.com/t/email-issues/124103 "2007-12-24T19:13:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 24, 2007, 7:13pm UTC](https://www.ruby-forum.com/t/email-issues/124103/1 "2007-12-24T19:13:36Z")

</div>

I am having troubles getting the email configured to work properly.

On the development side I have updated the config settings to throw  
errors if they occur, but the email seems to go through ok, but I never  
receive the email.

On the production server I get the following error message when creating  
a user that emails a confirmation via the after\_create method.

Loading production environment (Rails 2.0.2)

> > ```
> > User.create({
> > 
> > ```

?\> :login =\> “admin”,  
?\> :password =\> “XXXXX”,  
?\> :password\_confirmation =\> “XXXXX”,  
?\> :first\_name =\> “john”,  
?\> :last\_name =\> “doe”,  
?\> :email =\> “removed\_email\_address@domain.invalid”

> > ```
> > })
> > 
> > ```

Net::SMTPFatalError: 554 Message refused.

On both servers I am using sendmail, although on the development server  
I have also tried smtp (config.action\_mailer.delivery\_method =  
:sendmail).

Both severs also have the sendmail file in the /usr/sbin folder.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 24, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/email-issues/124103/2 "2007-12-24T20:00:32Z")

</div>

Test the sendmail installation from the command line. Make sure you  
don’t  
have any permission issues. There is no configuration required for  
sendmail.  
Rails will automagically send mails.

On Dec 24, 2007 10:13 AM, Chris O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On the production server I get the following error message when creating
> 
> Net::SMTPFatalError: 554 Message refused.
> 
> On both servers I am using sendmail, although on the development server  
> I have also tried smtp (config.action\_mailer.delivery\_method =  
> :sendmail).

–  
[http://www.rubyplus.org/](http://www.rubyplus.org/)  
Free Ruby Screencasts

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 24, 2007, 8:22pm UTC](https://www.ruby-forum.com/t/email-issues/124103/3 "2007-12-24T20:22:14Z")

</div>

Hey Bala,

I was just able to get the development version sending emails with  
sendmail (and smtp), and the only thing that I can think of why it now  
works was probably due to a server restart.

I made the mistake of saying that previously the server was using  
sendmail, which it wasn’t, but rather it was using smtp. I did try  
restarting the server with those same settings to no avail. I have also  
set the server to use sendmail and am now able to create users from the  
console (email failure doesn’t cause rollback), but I am not receiving  
any emails.

I am not sure what the problem is now.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 24, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/email-issues/124103/4 "2007-12-24T23:02:29Z")

</div>

Test email addresses with different domains. Is the mail server running  
on  
the local server where your Rails app is deployed? Can you connect email  
client such as Apple Mail using the SMTP server settings and send email?

If the mail server is configured properly, you should define the mail  
server  
settings in the appropriate environment config file, ex - for production  
,  
define it in production.rb. In Rails 2.0 the syntax has changed:

ActionMailer::Base.smtp\_settings = define\_your\_server\_settings

On Dec 24, 2007 11:22 AM, Chris O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hey Bala,
> 
> I was just able to get the development version sending emails with  
> sendmail (and smtp), and the only thing that I can think of why it now  
> works was probably due to a server restart.

–  
[http://www.rubyplus.org/](http://www.rubyplus.org/)  
Free Ruby and Rails Screencasts

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 25, 2007, 3:58am UTC](https://www.ruby-forum.com/t/email-issues/124103/5 "2007-12-25T03:58:51Z")

</div>

Use email client such as ms outlook, eudora etc and use the parameters  
u r using in the rails app to connect to the email server. Check if u  
can send any email.

Sent from my iPhone

On Dec 24, 2007, at 5:26 PM, Chris O.  
\<removed\_email\_address@domain.invalid

> wrote:

> > Can you connect email client such as Apple Mail using the SMTP  
> > server settings and send email?
> 
> Not sure what you mean

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 25, 2007, 2:26am UTC](https://www.ruby-forum.com/t/email-issues/124103/6 "2007-12-25T02:26:06Z")

</div>

Bala P. wrote:

> Test email addresses with different domains.

Doesn’t email to any of them.

> Is the mail server running on  
> the local server where your Rails app is deployed?

It is

> Can you connect email client such as Apple Mail using the SMTP server settings and send email?

Not sure what you mean

> If the mail server is configured properly, you should define the mail server  
> settings in the appropriate environment config file, ex - for production,  
> define it in production.rb. In Rails 2.0 the syntax has changed:
> 
> ActionMailer::Base.smtp\_settings = define\_your\_server\_settings

I am using sendmail right now so I don’t have any server settings.  
config.action\_mailer.delivery\_method = :sendmail

I will try to see if smtp works with the settings in the 2.0 format.

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [December 25, 2007, 6:16am UTC](https://www.ruby-forum.com/t/email-issues/124103/7 "2007-12-25T06:16:45Z")

</div>

To test this I reverted back to my config settings I used before (smtp)  
to test this and it now works. I have no idea why it is working now,  
but I am happy.

Thanks for the help.

Bcp wrote:

> Use email client such as ms outlook, eudora etc and use the parameters  
> u r using in the rails app to connect to the email server. Check if u  
> can send any email.
> 
> Sent from my iPhone
> 
> On Dec 24, 2007, at 5:26 PM, Chris O.  
> \<removed\_email\_address@domain.invalid
> 
> > wrote:
> 
> > > Can you connect email client such as Apple Mail using the SMTP  
> > > server settings and send email?
> > 
> > Not sure what you mean
