Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Simple "Send Email From Ruby" Method

DZone's Guide to

Simple "Send Email From Ruby" Method

·
Free Resource
By 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

  
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}