Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rubysmtp [2014/10/26 01:52] (current)
Line 1: Line 1:
 +==== Send email using Net::SMTP under Ruby ====
 +
 +<code lang=ruby>​
 +# smtp.rb
 +
 +require '​net/​smtp'​
 +require '​pp'​
 +
 +smtp = Net::​SMTP.new('​mail.mnain.org'​)
 +#p smtp
 +smtp.start('​madan@mnain.org'​)
 +msg = "​Subject:​ Test\r\n"​ +
 +                "From: Madan Nain <​madan@mnain.org>​\r\n"​ +
 +                "​\r\n"​ +
 +                "This is a test message " +
 +                " from Madan to madan@mnain.org " +
 +                "​\r\n"​ +
 +                " testing smtp using ruby " +
 +                "​Second line of msg " +
 +                "​\r\n"​
 +puts msg
 +
 +#p smtp
 +smtp.sendmail(msg,​ '​madan@mnain.org','​learn@mnain.org'​)
 +</​code>​
 +
 +----
 +
 +  *  [[rubyinfo|Back to Ruby]]
  
rubysmtp.txt ยท Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0