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

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 (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

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

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

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

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/
Learn rails: http://sensei.zenunit.com/

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

Ah! All it needed was:

ActionMailer::Base.delivery_method = :sendmail

I was sure I was missing something obvious.

Thanks for your help!
Chris