I’m new to ruby and trying to build a script that logs into a cisco pix
and diff the config from the day before. I’m having issues passing the
diff to an email and having carriage returns after each change.
Basically it outputs all text with no carriage returns to the body.
Here is the code for the email side. Any help would be appreciated.
def sendMail
from = '[email protected]
to = ‘[email protected]’
dif = Diffy::Diff.new("#{@a[0]}", “#{@a[1]}”, :source => ‘files’,
:diff => “-b”)
message = <<MESSAGE
From: “#{from}”
To: “#{to}”
MIME-Version: 1.0
Content-type: text/html
Subject: The firewall has changed
The firewall has changed since yesterday!!!
#{dif}
MESSAGE
Net::SMTP.start('mail.home.com',25) do |smtp|
smtp.send_message message,from,to
end