Hello everyone,
I'm trying to use ActionMailer to send out emails via a third party
SMTP service. On my development box (running ruby 1.8.6) everything
works without a hitch. On the production server(ruby 1.8.7) it fails
because the ActionMailer is trying to use SSL. So any suggestions as
to how to stop this?
I've tried adding:
ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false to
both the environments file, and the actual ActionMailer intializer.
And I've also tried commenting out the check in the ActionMailer base
code, but neither worked.
Any ideas?
Thanks!
Miah Petersen
It occurred to me that maybe seeing the initialization code might help you help me, so here it is
ActionMailer::Base.smtp_settings = {
:address => “mail.thirdpartydomain.com”,
:domain => “www.mydmain.com”,
:port => 2525,
:authentication => :login,
:user_name => “username”,
:password => “password”
}
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = “utf-8”
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_content_type =“text/html”
try port 25 instead of 2525.
Thanks for the suggestion, but swapping the port generated the same
error. Also, I have a separate pure ruby script that uses Net::SMTP
to send via the third party server without any issues.
Below is the full trace if that helps.
Net::SMTPServerBusy in UserController#new_password
428 4.0.0 Your account is using SSL - either disable it in your email
client or enable it at http://control.authsmtp.com
/usr/lib/ruby/1.8/net/smtp.rb:930:in `check_response'
/usr/lib/ruby/1.8/net/smtp.rb:899:in `getok'
/usr/lib/ruby/1.8/net/smtp.rb:828:in `mailfrom'
/usr/lib/ruby/1.8/net/smtp.rb:653:in `sendmail'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:673:in
`perform_delivery_smtp'
/usr/lib/ruby/1.8/net/smtp.rb:526:in `start'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:671:in
`perform_delivery_smtp'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:526:in
`__send__'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:526:in
`deliver!'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:426:in
`deliver'
app/controllers/user_controller.rb:424:in `new_password'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in
`send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in
`perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in
`call_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:in
`perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:in
`perform_action_without_caching'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in
`passenger_orig_perform_action'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
`cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in
`cache'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:in
`passenger_orig_perform_action'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/request_handler.rb:64:in
`perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
`send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
`process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in
`process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in
`process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:in
`process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in
`handle_request'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in
`dispatch_unlocked'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in
`dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/request_handler.rb:49:in
`process_request'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_request_handler.rb:206:in
`main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:376:in
`start_request_handler'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:334:in
`handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/utils.rb:182:in
`safe_fork'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:332:in
`handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in
`__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in
`main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:195:in
`start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:162:in
`start'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:213:in
`start'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:261:in
`spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server_collection.rb:126:in
`lookup_or_add'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:255:in
`spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server_collection.rb:80:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server_collection.rb:79:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:254:in
`spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:153:in
`spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:286:in
`handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in
`__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in
`main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:195:in
`start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/bin/passenger-spawn-server:61
try a different smtp service (or service provider).
It’s explained here
http://e-haitham.blogspot.com/2008/05/rails-actionmailer-with-tls-ssl.html
config.action_mailer.smtp_settings = {
:address => '[smtp.mailserver.com](http://smtp.mailserver.com)',
:port => 123,
:domain => "your domain name",
:authentication => :login,
:user_name => "account@mailserver.com",
:password => "account_password",
**:tls => true**
}
That’s it for the problem. We need to use the great ActionMailer, with a respectful smtp server that requires SSL at the same time. The solution is the magical plugin action_mailer_tls. You just download and install the plugin, and add one line to the smtp settings:``
That’s it. Now you can generate mails and use that smtp server with TLS to forward your emails. Pretty handy, right?
Actually isn't my issue sort of the inverse of this? I do not need
SSL, and yet for some reason ActionMailer 2.2.2 in ruby 1.8.7 is
trying to send via an SSL connection, but ActionMailer 2.2.1 in 1.8.6
it doesn't.
And I just checked, my development box is running ActionMailer 2.2.2
on ruby 1.8.6 (not what i mentioned in the previous email), and it has
no issue sending via the 3rd party server. I am so terribly confused
as to what could be causing this since everything says that
ActionMailer can send via SSL only if you install one of the plugins
(like you mentioned earlier).
My normal course of action is to respond to what the error logs, compiler complaints, any messages from the system.
I’d install that plugin.