I am trying to send an email using the code below. I am able to send the
email but I need the code to do the following:

*in the body of the email I need the content of Document.txt which is
stored in "ms". Right now in the body of the email I send there is "ms"
and not the content in "ms".

*Also in the subject I want to be able have the values of the variables
t and y. At the moment the subject of the email sent has t and y and not
the values.

Please let me know if I am not clear on what I am trying to achieve and
I will try my best to make it clear.

#!/usr/bin/env ruby

require 'net/smtp'

   File.open("/home/path/Document.txt","r") do |file|
   ms=file

     File.open 'email2.txt' do |file|
     y= file.find { |line| line =~ /San/ }
     t=y.scan /San: (\w+)/i

     x= file.find { |line| line =~ /verity/ }
     s=x.scan /verity: (\d+)/i

msgstr = <<EOF
From: m / example.com
To: d / example.com
Subject: t,y

ms

EOF

Net::SMTP.start('serverIP', portnumber) do |smtp|
    smtp.send_message msgstr,
                 'm / example.com',
                 'd / example.com'

end

-- 
Posted via http://www.ruby-forum.com/.