3

I have testmail.rb on a CENTOS 5 VM with SELinux permissive and IPtables off:

require 'rubygems'
require 'mail'

options = { :address              => "mail.domain.com",
            :port                 => 466,
            :domain               => 'otherdomain.com',
            :user_name            => 'somedude@domain.com',
            :password             => 'topsecret',
            :authentication       => 'plain',
            :enable_starttls_auto => 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

The result when the script is run is this:

Date: Tue, 30 Nov 2010 12:12:58 -0500
From: somedude@otherdomain.com
To: admin@domain.com
Message-ID: <4cf5309a2f074_284015c5c4de91b8270b2@apvdbs03.3rdomain.local.mail>
Subject: This is a test email
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

test!

"test!" is the content of body.txt.

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?

What are some ways I can see what's going on during the script execution to troubleshoot?

Update: Tried redirecting: > log.log 2>&1, but that didn't provide any additional info.

4

1 回答 1

7

您错过了实际发送的线路。尝试添加

mail.deliver!

到你的脚本的末尾。

于 2010-11-30T17:02:48.580 回答