# Stop ActionMailer from trying to send securely

**URL:** <https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533>\
**Category:** Rails\
**Created:** [March 4, 2010, 1:28am UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533 "2010-03-04T01:28:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 1:28am UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/1 "2010-03-04T01:28:15Z")

</div>

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 P.

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 9:04pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/2 "2010-03-04T21:04:14Z")

</div>

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](http://mail.thirdpartydomain.com)”,  
:domain =\> “[www.mydmain.com](http://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”

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 9:39pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/3 "2010-03-04T21:39:57Z")

</div>

try port 25 instead of 2525.

On 4 March 2010 15:02, Miah P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> }
> 
> > I’m trying to use ActionMailer to send out emails via a third party
> > 
> > .  
> > .  
> > For more options, visit this group at  
> > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
Charles A. Lopez  
removed\_email\_address@domain.invalid

What’s your vision for your organization?  
What’s your biggest challenge?

Let’s talk.  
(IBM Partner)

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 10:14pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/4 "2010-03-04T22:14:29Z")

</div>

try a different smtp service (or service provider).

On 4 March 2010 16:06, Miah P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> `perform\_delivery\_smtp’
> 
> `perform\_action\_without\_benchmark’
> 
> `passenger\_orig\_perform\_action’  
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/filters.rb:606:in
> 
> `dispatch’  
> /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion\_passenger/abstract\_request\_handler.rb:206:in
> 
> `start\_synchronously’  
> /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion\_passenger/abstract\_server\_collection.rb:126:in
> 
> ` **send** ’
> 
> > > :port =\> 2525,  
> > > On Wed, Mar 3, 2010 at 1:35 PM, miah [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > 
> > > > both the environments file, and the actual ActionMailer intializer.  
> > > > To post to this group, send email to removed\_email\_address@domain.invalid  
> > > > Groups “Ruby on Rails: Talk” group.  
> > > > Charles A. Lopez  
> > > > You received this message because you are subscribed to the Google G.  
> > > > “Ruby on Rails: Talk” group.  
> > > > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > > > To unsubscribe from this group, send email to  
> > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > > .  
> > > > For more options, visit this group at  
> > > > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
Charles A. Lopez  
removed\_email\_address@domain.invalid

What’s your vision for your organization?  
What’s your biggest challenge?

Let’s talk.  
(IBM Partner)

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 10:18pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/5 "2010-03-04T22:18:35Z")

</div>

It’s explained here

[http://e-haitham.blogspot.com/2008/05/rails-actionmailer-with-tls-ssl.html](http://e-haitham.blogspot.com/2008/05/rails-actionmailer-with-tls-ssl.html)

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[http://agilewebdevelopment.com/plugins/actionmailer\_tls](http://agilewebdevelopment.com/plugins/actionmailer_tls).  
You just download and install the plugin, and add one line to the smtp  
settings:

config.action\_mailer.smtp\_settings = {  
:address =\> ‘[smtp.mailserver.com](http://smtp.mailserver.com)’,  
:port =\> 123,  
:domain =\> “your domain name”,  
:authentication =\> :login,  
:user\_name =\> “removed\_email\_address@domain.invalid”,  
:password =\> “account\_password”,  
_:tls =\> true_  
}

That’s it. Now you can generate mails and use that smtp server with TLS  
to  
forward your emails. Pretty handy, right?

On 4 March 2010 16:13, Charles A. Lopez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > /usr/lib/ruby/gems/1.8/gems/actionmailer-2.2.2/lib/action\_mailer/base.rb:673:in  
> > `deliver!’
> > 
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/benchmarking.rb:68:in
> > 
> > `send’  
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/base.rb:392:in
> > 
> > `dispatch’  
> > /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion\_passenger/railz/application\_spawner.rb:334:in
> > 
> > `start’  
> > /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion\_passenger/abstract\_server\_collection.rb:80:in
> > 
> > `start\_synchronously’  
> > you help me, so here it is
> > 
> > > > ActionMailer::Base.raise\_delivery\_errors = true
> > > > 
> > > > > because the ActionMailer is trying to use SSL. So any suggestions as  
> > > > > Miah P.  
> > > > > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).  
> > > > > For more options, visit this group at
> > 
> > .  
> > For more options, visit this group at  
> > What’s your biggest challenge?
> 
> Let’s talk.  
> (IBM Partner)

–  
Charles A. Lopez  
removed\_email\_address@domain.invalid

What’s your vision for your organization?  
What’s your biggest challenge?

Let’s talk.  
(IBM Partner)

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 10:08pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/6 "2010-03-04T22:08:03Z")

</div>

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

On Thu, Mar 4, 2010 at 2:38 PM, Charles A. Lopez

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 10:24pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/7 "2010-03-04T22:24:26Z")

</div>

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.

On Thu, Mar 4, 2010 at 3:17 PM, Charles A. Lopez

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 4, 2010, 10:42pm UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/8 "2010-03-04T22:42:00Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![miah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@miah](https://www.ruby-forum.com/u/miah)\
**Post date:** [March 5, 2010, 12:23am UTC](https://www.ruby-forum.com/t/stop-actionmailer-from-trying-to-send-securely/184533/9 "2010-03-05T00:23:16Z")

</div>

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.

On 4 March 2010 16:40, Miah P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > trying to send via an SSL connection, but ActionMailer 2.2.1 in 1.8.6
> > 
> > > respectful smtp server that requires SSL at the same time. The solution  
> > > :user\_name =\> “removed\_email\_address@domain.invalid”,
> > > 
> > > > > /usr/lib/ruby/1.8/net/smtp.rb:653:in `sendmail’
> > > > > 
> > > > > app/controllers/user\_controller.rb:424:in `new\_password’  
> > > > > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/filters.rb:617:in
> > > > > 
> > > > > `passenger\_orig\_perform\_action’  
> > > > > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/caching/sql\_cache.rb:12:in
> > > > > 
> > > > > `dispatch\_unlocked’  
> > > > > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/dispatcher.rb:122:in
> > > > > 
> > > > > `handle\_spawn\_application’  
> > > > > /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion\_passenger/abstract\_server.rb:195:in
> > > > > 
> > > > > `spawn\_rails\_application’  
> > > > > /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion\_passenger/abstract\_server.rb:351:in  
> > > > > /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/bin/passenger-spawn-server:61
> > > > > 
> > > > > > > you help me, so here it is  
> > > > > > > ActionMailer::Base.raise\_delivery\_errors = true  
> > > > > > > everything
> > > > > > > 
> > > > > > > > And I’ve also tried commenting out the check in the ActionMailer  
> > > > > > > > To post to this group, send email to  
> > > > > > > > Groups “Ruby on Rails: Talk” group.  
> > > > > > > > –  
> > > > > > > > –  
> > > > > > > > –
> > > > 
> > > > Let’s talk.  
> > > > What’s your vision for your organization?  
> > > > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > > > “Ruby on Rails: Talk” group.  
> > > > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > > > To unsubscribe from this group, send email to  
> > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > > .  
> > > > For more options, visit this group at  
> > > > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
Charles A. Lopez  
removed\_email\_address@domain.invalid

What’s your vision for your organization?  
What’s your biggest challenge?

Let’s talk.  
(IBM Partner)
