# 500/Timeout when trying to send an email with my app?

**URL:** <https://www.ruby-forum.com/t/500-timeout-when-trying-to-send-an-email-with-my-app/159612>\
**Category:** Rails\
**Created:** [February 6, 2009, 11:24am UTC](https://www.ruby-forum.com/t/500-timeout-when-trying-to-send-an-email-with-my-app/159612 "2009-02-06T11:24:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 6, 2009, 11:24am UTC](https://www.ruby-forum.com/t/500-timeout-when-trying-to-send-an-email-with-my-app/159612/1 "2009-02-06T11:24:14Z")

</div>

Hello -

I’m kind of new to this whole web development thing - I have a VPS and  
I’ve installed ubuntu 8.04 and postfix on it, and now I’m deploying  
simple rails apps to get the hang of the whole process.

So I put together a small forum application, based on the  
restful\_authentication plugin. I’ve changed user\_mailer.rb to reflect  
the signup/activation emails that I want to send, but I haven’t modified  
restful\_authentication beyond that - it’s very basic and vanilla.

So I managed to use mod\_rails to get my little app up and running - I  
can see the empty forum and everything - but when I go to sign up as a  
new user, I submit my information and the browser hangs for a short  
while. Finally, it gives me the Rails 500 “We’re sorry, but something  
went wrong” screen.

The final entry in production.log is:

* * *

Processing UsersController#create (for 62.90.14.161 at 2009-02-06  
04:35:22) [POST]  
Parameters: {“user”=\>{“password\_confirmation”=\>“(my password)”,  
“password”=\>“(my password)”, “login”=\>“chris”, “email”=\>“(my email  
address)”}, “commit”=\>“Sign up”,  
“authenticity\_token”=\>“pqOfNV4NB0xZG56nISFIf6jHM7f7KKUoG8FJhG1wvyM=”}  
Sent mail to (my email address)

Timeout::Error (execution expired):  
/usr/lib/ruby/1.8/timeout.rb:54:in `new' /usr/lib/ruby/1.8/net/protocol.rb:206:in `old\_open’  
/usr/lib/ruby/1.8/timeout.rb:56:in `timeout' /usr/lib/ruby/1.8/timeout.rb:76:in `timeout’  
/usr/lib/ruby/1.8/net/protocol.rb:206:in `old_open' /usr/lib/ruby/1.8/net/smtp.rb:393:in `do\_start’  
/usr/lib/ruby/1.8/net/smtp.rb:378:in `start' actionmailer (2.3.0) lib/action_mailer/base.rb:679:in `perform\_delivery\_smtp’  
actionmailer (2.3.0) lib/action\_mailer/base.rb:521:in ` __send__' actionmailer (2.3.0) lib/action_mailer/base.rb:521:in `deliver!’  
actionmailer (2.3.0) lib/action\_mailer/base.rb:393:in `method_missing' app/models/user_observer.rb:3:in `after\_create’  
activerecord (2.3.0) lib/active\_record/observer.rb:171:in `send' activerecord (2.3.0) lib/active_record/observer.rb:171:in `update’  
/usr/lib/ruby/1.8/observer.rb:185:in `notify_observers' /usr/lib/ruby/1.8/observer.rb:184:in `each’  
/usr/lib/ruby/1.8/observer.rb:184:in `notify_observers' activerecord (2.3.0) lib/active_record/callbacks.rb:329:in `notify’  
activerecord (2.3.0) lib/active\_record/callbacks.rb:322:in `callback' activerecord (2.3.0) lib/active_record/callbacks.rb:239:in `create’  
activerecord (2.3.0) lib/active\_record/base.rb:2862:in  
`create_or_update_without_callbacks' activerecord (2.3.0) lib/active_record/callbacks.rb:222:in `create\_or\_update’  
activerecord (2.3.0) lib/active\_record/base.rb:2532:in  
`save_without_validation' activerecord (2.3.0) lib/active_record/validations.rb:1009:in `save\_without\_dirty’  
activerecord (2.3.0) lib/active\_record/dirty.rb:79:in  
`save_without_autosave_associations' activerecord (2.3.0) lib/active_record/autosave_association.rb:147:in `save\_without\_transactions’  
activerecord (2.3.0) lib/active\_record/transactions.rb:229:in `send' activerecord (2.3.0) lib/active_record/transactions.rb:229:in `with\_transaction\_returning\_status’  
activerecord (2.3.0)  
lib/active\_record/connection\_adapters/abstract/database\_statements.rb:136:in  
`transaction' activerecord (2.3.0) lib/active_record/transactions.rb:182:in `transaction’  
activerecord (2.3.0) lib/active\_record/transactions.rb:228:in  
`with_transaction_returning_status' activerecord (2.3.0) lib/active_record/transactions.rb:196:in `save’  
activerecord (2.3.0) lib/active\_record/transactions.rb:208:in  
`rollback_active_record_state!' activerecord (2.3.0) lib/active_record/transactions.rb:196:in `save’  
app/controllers/users\_controller.rb:14:in `create' actionpack (2.3.0) lib/action_controller/base.rb:1261:in `send’  
actionpack (2.3.0) lib/action\_controller/base.rb:1261:in  
`perform_action_without_filters' actionpack (2.3.0) lib/action_controller/filters.rb:617:in `call\_filters’  
actionpack (2.3.0) lib/action\_controller/filters.rb:610:in  
`perform_action_without_benchmark' actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:in `perform\_action\_without\_rescue’  
actionpack (2.3.0) lib/action\_controller/benchmarking.rb:68:in  
`perform_action_without_rescue' actionpack (2.3.0) lib/action_controller/rescue.rb:154:in `perform\_action\_without\_flash’  
actionpack (2.3.0) lib/action\_controller/flash.rb:141:in  
`perform_action' actionpack (2.3.0) lib/action_controller/base.rb:523:in `send’  
actionpack (2.3.0) lib/action\_controller/base.rb:523:in  
`process_without_filters' actionpack (2.3.0) lib/action_controller/filters.rb:606:in `process’  
actionpack (2.3.0) lib/action\_controller/base.rb:391:in `process' actionpack (2.3.0) lib/action_controller/base.rb:386:in `call’  
actionpack (2.3.0) lib/action\_controller/routing/route\_set.rb:433:in  
`call' actionpack (2.3.0) lib/action_controller/dispatcher.rb:65:in `dispatch’  
actionpack (2.3.0) lib/action\_controller/dispatcher.rb:88:in `_call' actionpack (2.3.0) lib/action_controller/dispatcher.rb:59:in `initialize’  
activerecord (2.3.0) lib/active\_record/query\_cache.rb:29:in `call' activerecord (2.3.0) lib/active_record/query_cache.rb:29:in `call’  
activerecord (2.3.0)  
lib/active\_record/connection\_adapters/abstract/query\_cache.rb:34:in  
`cache' activerecord (2.3.0) lib/active_record/query_cache.rb:9:in `cache’  
activerecord (2.3.0) lib/active\_record/query\_cache.rb:28:in `call' actionpack (2.3.0) lib/action_controller/params_parser.rb:15:in `call’  
actionpack (2.3.0) lib/action\_controller/rewindable\_input.rb:25:in  
`call' actionpack (2.3.0) lib/action_controller/session/cookie_store.rb:93:in `call’  
actionpack (2.3.0) lib/action\_controller/failsafe.rb:11:in `call' actionpack (2.3.0) lib/action_controller/rack_ext/lock.rb:15:in `call’  
actionpack (2.3.0) lib/action\_controller/rack\_ext/lock.rb:15:in  
`synchronize' actionpack (2.3.0) lib/action_controller/rack_ext/lock.rb:15:in `call’  
actionpack (2.3.0) lib/action\_controller/dispatcher.rb:83:in `call’

Rendering ./public/500.html (500 Internal Server Error)

* * *

I’ve tried this a few times, but it’s always the same. Despite what it  
says, I don’t receive any mail at my address. I can use postfix to send  
mail from the command line just fine.

I’m thinking that I must have set up postfix wrong, but I’m not sure  
how. I followed this guide:  
[http://articles.slicehost.com/2008/7/29/postfix-installation](http://articles.slicehost.com/2008/7/29/postfix-installation) (I haven’t  
done any of the more advanced guides on this site - receiving mail,  
multiple domains… it’s all very basic)

So, bottom line, my server can send mail, and when my rails app tries to  
send mail it says it succeeds (but doesn’t) and then hangs. Where should  
I look now? I’m kind of stumped, and I feel like I’m missing something  
really obvious.

Thanks!  
Chris

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 6, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/500-timeout-when-trying-to-send-an-email-with-my-app/159612/2 "2009-02-06T13:14:23Z")

</div>

What method of sending mail are you using? Check your logs while you  
sen the mail.

Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

On 06/02/2009, at 9:24 PM, Chris H. \<rails-mailing-list@andreas-

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 6, 2009, 1:15pm UTC](https://www.ruby-forum.com/t/500-timeout-when-trying-to-send-an-email-with-my-app/159612/3 "2009-02-06T13:15:34Z")

</div>

Sorry debt read enough of the mail. Badicall it’s timing out when  
sending touour SMTP server. Are u sure the settings are right?

Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

On 06/02/2009, at 9:24 PM, Chris H. \<rails-mailing-list@andreas-

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 6, 2009, 2:36pm UTC](https://www.ruby-forum.com/t/500-timeout-when-trying-to-send-an-email-with-my-app/159612/4 "2009-02-06T14:36:42Z")

</div>

Ah! All it needed was:

ActionMailer::Base.delivery\_method = :sendmail

I was sure I was missing something obvious.

Thanks for your help!  
Chris
