Simple "Send Email From Ruby" Method
Join the DZone community and get the full member experience.
Join For FreeBy Ian Purton and found at http://jiploo.com/blog/simple-email-send-function-in-ruby/
def send_email(from, from_alias, to, to_alias, subject, message)
msg = <
To: #{to_alias} <#{to}>
Subject: #{subject}
#{message}
END_OF_MESSAGE
Net::SMTP.start('localhost') do |smtp|
smtp.send_message msg, from, to
end
end
Opinions expressed by DZone contributors are their own.
Comments