Ruby Mail gem like script mail messages

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

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

Result when the script is executed:

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 addresses are sent to the account. The smtp settings that we received from the domain administrator sent. I used telnet to successfully send email to a domain on an unencrypted port (25), but did not receive a response from an encrypted port (466), perhaps because my telnet session was unencrypted?

How can I see what happens during the execution of the script for troubleshooting?

Update: I tried redirecting:> log.log 2> & 1, but this did not provide any additional information.

+3
1

.

mail.deliver!

script.

+7

Source: https://habr.com/ru/post/1777701/


All Articles