lib/fluent/plugin/out_mail.rb in fluent-plugin-mail-0.1.1 vs lib/fluent/plugin/out_mail.rb in fluent-plugin-mail-0.1.2
- old
+ new
@@ -1,5 +1,7 @@
+require 'securerandom'
+
class Fluent::MailOutput < Fluent::Output
Fluent::Plugin.register_output('mail', self)
# Define `log` method for v0.10.42 or earlier
unless method_defined?(:log)
@@ -188,16 +190,19 @@
date = Time::now.timezone(time_locale)
else
date = Time::now
end
+ mid = sprintf("<%s@%s>", SecureRandom.uuid, SecureRandom.uuid)
+
debug_msg = smtp.send_mail(<<EOS, @from, @to.split(/,/), @cc.split(/,/), @bcc.split(/,/))
Date: #{date.strftime("%a, %d %b %Y %X %z")}
From: #{@from}
To: #{@to}
Cc: #{@cc}
Bcc: #{@bcc}
Subject: #{subject}
+Message-Id: #{mid}
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
#{body}
EOS