Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm developing a Rails app which when I run it locally, it's able to send emails through a gmail account via smtp.

When I moved it to my sever (running Nginx), it comes up with the following error for example when I try to create a new user.

Net::SMTPAuthenticationError in UsersController#create

535-5.7.1 Username and Password not accepted.

The nginx.conf file remains the same from when I set it up.

share|improve this question
1  
This seems to be more of a rails error message. Which environment are you running on you laptop, and which environment are you running on the server? –  becomingwisest Apr 9 '12 at 23:23
    
Both are running rails 3.1.3 and ruby 1.8.7 - Laptop is running Ubuntu 11.10 and the Server is running the same but the server edition. –  Spoons Apr 9 '12 at 23:27
    
Good details to know, but I meant more of that as defined by rails oldwiki.rubyonrails.org/rails/pages/Environments . Which file did you configure the mail server, port, username and password? –  becomingwisest Apr 9 '12 at 23:30
    
If your server is not running in the development environment, or if the server has some sort of firewall blocking outbound connections. It could result in these errors. I'm guessing its the environment. –  becomingwisest Apr 9 '12 at 23:38
1  
Are you in control of the server? If not you might want to talk to the sysadmin. If you are, you can try connecting to a remote SMTP server using Telnet to spoof a simple email (plenty of quick tutorials on that) to see if the connection works or where it's being blocked. –  Bart Silverstrim Apr 10 '12 at 0:07

1 Answer 1

To make sure, your SMTP information should look like this:

# Correct configuration to get this working is:
config.action_mailer.smtp_settings = {
    :enable_starttls_auto => true,
    :address        => 'smtp.gmail.com',
    :port           => 587,
    :domain         => 'whatever.yourrubyapp.com',
    :authentication => :plain,
    :user_name      => 'username@gmail.com',
    :password       => 'password'
}
share|improve this answer
    
This is nearly identical to what is in my development.rb file, it succeeds in sending emails from my laptop but not from my server. –  Spoons Apr 10 '12 at 0:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.