Last active
August 30, 2015 10:24
-
-
Save hlxwell/125622 to your computer and use it in GitHub Desktop.
ruby sending mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_email(to, subject, body) | |
puts "sending email => #{subject}" | |
IO.popen(CONFIG[:sendmail_command],"w+") do |sm| | |
message = | |
%Q{Date: #{Time.now} | |
From: House Notify <[email protected]> | |
To: #{to} | |
Subject: #{subject} | |
Mime-Version: 1.0 | |
Content-Type: text/plain; charset=iso-2022-jp | |
#{body} | |
} | |
puts message | |
sm.print(message) | |
sm.flush | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment