<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -213,6 +213,8 @@ module ActionMailer #:nodoc:
   #   * &lt;tt&gt;:password&lt;/tt&gt; - If your mail server requires authentication, set the password in this setting.
   #   * &lt;tt&gt;:authentication&lt;/tt&gt; - If your mail server requires authentication, you need to specify the authentication type here.
   #     This is a symbol and one of &lt;tt&gt;:plain&lt;/tt&gt;, &lt;tt&gt;:login&lt;/tt&gt;, &lt;tt&gt;:cram_md5&lt;/tt&gt;.
+  #   * &lt;tt&gt;:enable_starttls_auto&lt;/tt&gt; - When set to true, detects if STARTTLS is enabled in your SMTP server and starts to use it.
+  #     It works only on Ruby &gt;= 1.8.7 and Ruby &gt;= 1.9. Default is true.
   #
   # * &lt;tt&gt;sendmail_settings&lt;/tt&gt; - Allows you to override options for the &lt;tt&gt;:sendmail&lt;/tt&gt; delivery method.
   #   * &lt;tt&gt;:location&lt;/tt&gt; - The location of the sendmail executable. Defaults to &lt;tt&gt;/usr/sbin/sendmail&lt;/tt&gt;.
@@ -230,10 +232,13 @@ module ActionMailer #:nodoc:
   #
   # * &lt;tt&gt;default_charset&lt;/tt&gt; - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
   #   pick a different charset from inside a method with +charset+.
+  #
   # * &lt;tt&gt;default_content_type&lt;/tt&gt; - The default content type used for the main part of the message. Defaults to &quot;text/plain&quot;. You
   #   can also pick a different content type from inside a method with +content_type+.
+  #
   # * &lt;tt&gt;default_mime_version&lt;/tt&gt; - The default mime version used for the message. Defaults to &lt;tt&gt;1.0&lt;/tt&gt;. You
   #   can also pick a different value from inside a method with +mime_version+.
+  #
   # * &lt;tt&gt;default_implicit_parts_order&lt;/tt&gt; - When a message is built implicitly (i.e. multiple parts are assembled from templates
   #   which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
   #   &lt;tt&gt;[&quot;text/html&quot;, &quot;text/enriched&quot;, &quot;text/plain&quot;]&lt;/tt&gt;. Items that appear first in the array have higher priority in the mail client
@@ -252,12 +257,13 @@ module ActionMailer #:nodoc:
     cattr_accessor :logger
 
     @@smtp_settings = {
-      :address        =&gt; &quot;localhost&quot;,
-      :port           =&gt; 25,
-      :domain         =&gt; 'localhost.localdomain',
-      :user_name      =&gt; nil,
-      :password       =&gt; nil,
-      :authentication =&gt; nil
+      :address              =&gt; &quot;localhost&quot;,
+      :port                 =&gt; 25,
+      :domain               =&gt; 'localhost.localdomain',
+      :user_name            =&gt; nil,
+      :password             =&gt; nil,
+      :authentication       =&gt; nil,
+      :enable_starttls_auto =&gt; true,
     }
     cattr_accessor :smtp_settings
 
@@ -669,7 +675,7 @@ module ActionMailer #:nodoc:
         sender = mail['return-path'] || mail.from
 
         smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
-        smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto)
+        smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] &amp;&amp; smtp.respond_to?(:enable_starttls_auto)
         smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
                    smtp_settings[:authentication]) do |smtp|
           smtp.sendmail(mail.encoded, sender, destinations)</diff>
      <filename>actionmailer/lib/action_mailer/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -948,6 +948,7 @@ EOF
   end
 
   def test_starttls_is_enabled_if_supported
+    ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
     MockSMTP.any_instance.expects(:respond_to?).with(:enable_starttls_auto).returns(true)
     MockSMTP.any_instance.expects(:enable_starttls_auto)
     ActionMailer::Base.delivery_method = :smtp
@@ -955,11 +956,22 @@ EOF
   end
 
   def test_starttls_is_disabled_if_not_supported
+    ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
     MockSMTP.any_instance.expects(:respond_to?).with(:enable_starttls_auto).returns(false)
     MockSMTP.any_instance.expects(:enable_starttls_auto).never
     ActionMailer::Base.delivery_method = :smtp
     TestMailer.deliver_signed_up(@recipient)
   end
+
+  def test_starttls_is_not_enabled
+    ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false
+    MockSMTP.any_instance.expects(:respond_to?).never
+    MockSMTP.any_instance.expects(:enable_starttls_auto).never
+    ActionMailer::Base.delivery_method = :smtp
+    TestMailer.deliver_signed_up(@recipient)
+  ensure
+    ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
+  end
 end
 
 end # uses_mocha</diff>
      <filename>actionmailer/test/mail_service_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ff0a2678c4bce9da348e1263915558795e3a3640</id>
    </parent>
  </parents>
  <author>
    <name>Jose' Valim</name>
    <login>josevalim</login>
    <email>jose.valim@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/c2e7851fb20d24f49b55b5276cc3056082721dc4</url>
  <id>c2e7851fb20d24f49b55b5276cc3056082721dc4</id>
  <committed-date>2009-01-17T20:19:18-08:00</committed-date>
  <authored-date>2009-01-11T02:02:54-08:00</authored-date>
  <message>Add ActionMailer::Base#enable_starttls_auto option for enabling/disabling STARTTLS. [#1731 state:resolved]

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>1a758d48341b243066a497aaf3afb68c4f06ed3a</tree>
  <committer>
    <name>Pratik Naik</name>
    <login>lifo</login>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
