Skip to content

Instantly share code, notes, and snippets.

@hlxwell
Last active August 30, 2015 10:24
Show Gist options
  • Save hlxwell/125622 to your computer and use it in GitHub Desktop.
Save hlxwell/125622 to your computer and use it in GitHub Desktop.
ruby sending mail
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 <notify@joblet.jp>
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