title: ActionMailer works on localhost but doesn't in a public server
body: <p>I built an application with Rails 3 and I made a simple contact us page to send mail through my SMTP server.
  The problem is my app can send mail when I run it in my local host (my pc), but it doesn't work when I run the app in the hosted server (hostgator).
  The funny stuff is that the smtp server is the same!</p>
  
  <p>This is the config in my localhost(and it works!):</p>
  
  <p><strong>config/environments/developer.rb</strong></p>
  
  <pre><code># ActionMailer Config
  config.action_mailer.default_url_options = { :host =&gt; 'localhost:3000' }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default :charset =&gt; "utf-8"
  </code></pre>
  
  <p><strong>config/initializers/setup_mail.rb</strong></p>
  
  <pre><code>ActionMailer::Base.smtp_settings = {  
    :address              =&gt; "mail.mydomain.org",  
    :port                 =&gt; 26,  
    :domain               =&gt; "app.mydomain.org",  
    :user_name            =&gt; "register@app.mydomain.org",  
    :password             =&gt; "********",  
    :authentication       =&gt; "plain",  
    :enable_starttls_auto =&gt; false  
  } 
  </code></pre>
  
  <p>The url for my host server is app.mydomain.org, so in the hosted app I changed only this:</p>
  
  <p><strong>config/environments/development.rb</strong></p>
  
  <pre><code># ActionMailer Config
  config.action_mailer.default_url_options = { :host =&gt; 'mydomain.org' }
  ...
  </code></pre>
  
  <p>In the host server, just for now I run the app with WEBrick in development mode.
  And I get a timeout error:</p>
  
  <pre><code>....
  Timeout::Error (execution expired):
    app/controllers/contact_us_controller.rb:13:in `create'
  ...
  </code></pre>
  
  <p>Am I missing somenthing??</p>
  
  <p><strong>EDIT &amp; SOLVED:</strong></p>
  
  <p>Hostgator support staff have just find out the cause of this issue.
  In the <code>ActionMailer</code> setup, the <code>:address</code> has to be <code>localhost</code>, and not <code>mail.mydomain.org</code>. So the ActionMailer would be:</p>
  
  <pre><code>ActionMailer::Base.smtp_settings = {  
    :address              =&gt; "localhost",  
    :port                 =&gt; 26,  
    :domain               =&gt; "app.mydomain.org",  
    :user_name            =&gt; "register@app.mydomain.org",  
    :password             =&gt; "********",  
    :authentication       =&gt; "plain",  
    :enable_starttls_auto =&gt; false  
  } 
  </code></pre>