title: Ruby Mail gem, how to script mail messages
body: <p>I have testmail.rb on a CENTOS 5 VM with SELinux permissive and IPtables off:</p>
  
  <pre><code>require 'rubygems'
  require 'mail'
  
  options = { :address              =&gt; "mail.domain.com",
              :port                 =&gt; 466,
              :domain               =&gt; 'otherdomain.com',
              :user_name            =&gt; 'somedude@domain.com',
              :password             =&gt; 'topsecret',
              :authentication       =&gt; 'plain',
              :enable_starttls_auto =&gt; true  }
   Mail.defaults do
    delivery_method :smtp, options
  end
  
   mail = Mail.new do
        from 'somedude@otherdomain.com'
          to 'admin@domain.com'
     subject 'This is a test email'
        body File.read('body.txt')
   end
  
  puts mail.to_s
  </code></pre>
  
  <p>The result when the script is run is this:</p>
  
  <pre><code>Date: Tue, 30 Nov 2010 12:12:58 -0500
  From: somedude@otherdomain.com
  To: admin@domain.com
  Message-ID: &lt;4cf5309a2f074_284015c5c4de91b8270b2@apvdbs03.3rdomain.local.mail&gt;
  Subject: This is a test email
  Mime-Version: 1.0
  Content-Type: text/plain;
   charset=UTF-8
  Content-Transfer-Encoding: 7bit
  
  test!
  </code></pre>
  
  <p>"test!" is the content of body.txt.</p>
  
  <p>No email ever reaches the sent to account. The smtp settings we got from the sent to domain admin. I used telnet to successfully send an email to the domain on the unencrypted port (25) but got no response from the encrypted port (466), possibly because my telnet session was unencrypted?</p>
  
  <p>What are some ways I can see what's going on during the script execution to troubleshoot?</p>
  
  <p>Update:
  Tried redirecting: > log.log 2>&amp;1, but that didn't provide any additional info.</p>