Forum: Ruby on Rails 500/Timeout when trying to send an email with my app?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Chris H. (Guest)
on 2009-02-06 12:24
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 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",
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
  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
  activerecord (2.3.0) lib/active_record/callbacks.rb:222:in
  activerecord (2.3.0) lib/active_record/base.rb:2532:in
  activerecord (2.3.0) lib/active_record/validations.rb:1009:in
  activerecord (2.3.0) lib/active_record/dirty.rb:79:in
  activerecord (2.3.0) lib/active_record/autosave_association.rb:147:in
  activerecord (2.3.0) lib/active_record/transactions.rb:229:in `send'
  activerecord (2.3.0) lib/active_record/transactions.rb:229:in
  activerecord (2.3.0)
  activerecord (2.3.0) lib/active_record/transactions.rb:182:in
  activerecord (2.3.0) lib/active_record/transactions.rb:228:in
  activerecord (2.3.0) lib/active_record/transactions.rb:196:in `save'
  activerecord (2.3.0) lib/active_record/transactions.rb:208:in
  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
  actionpack (2.3.0) lib/action_controller/filters.rb:617:in
  actionpack (2.3.0) lib/action_controller/filters.rb:610:in
  actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:in
  actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:in
  actionpack (2.3.0) lib/action_controller/rescue.rb:154:in
  actionpack (2.3.0) lib/action_controller/flash.rb:141:in
  actionpack (2.3.0) lib/action_controller/base.rb:523:in `send'
  actionpack (2.3.0) lib/action_controller/base.rb:523:in
  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
  actionpack (2.3.0) lib/action_controller/dispatcher.rb:65:in
  actionpack (2.3.0) lib/action_controller/dispatcher.rb:88:in `_call'
  actionpack (2.3.0) lib/action_controller/dispatcher.rb:59:in
  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)
  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
  actionpack (2.3.0) lib/action_controller/session/cookie_store.rb:93:in
  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
  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: (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.

Julian L. (Guest)
on 2009-02-06 14:14
(Received via mailing list)
What method of sending mail are you using? Check your logs while you
sen the mail.

Learn rails:

On 06/02/2009, at 9:24 PM, Chris H. <rails-mailing-list@andreas-
Julian L. (Guest)
on 2009-02-06 14:15
(Received via mailing list)
Sorry debt read enough of the mail. Badicall it's timing out when
sending touour SMTP server. Are u sure the settings are right?

Learn rails:

On 06/02/2009, at 9:24 PM, Chris H. <rails-mailing-list@andreas-
Chris H. (Guest)
on 2009-02-06 15:36
Ah! All it needed was:

ActionMailer::Base.delivery_method = :sendmail

I was sure I was missing something obvious.

Thanks for your help!
This topic is locked and can not be replied to.