文章会有【原创】或者【转载】标示,部分来自Google Baidu的学习结果 {Java/PHP/Python/Ruby/Go}

Ruby连接QQ企业邮箱用smtp发html格式的邮件[转载]  


require 'net/smtp'  

message = <<MESSAGE_END
From: Private Person <iceskysl@eoemobile.com>
To: A Test User <iceskysl@test.com>
MIME-Version: 1.0
Content-type: text/html
Subject: SMTP e-mail test

This is an e-mail message to be sent in HTML format

<b>This is HTML message.</b>
<h1>This is headline.</h1>
MESSAGE_END


begin
  Net::SMTP.start( 'smtp.qq.com', 25, "iceskysl.com", "admin@iceskysl.com", "xxxxxxx", :login ) do |smtp|  
    smtp.sendmail( message,  'admin@iceskysl.com', 'iceskysl@gmail.com' )  
  end
rescue Exception => e  
   print "Exception occured: " + e  
end

#Net::SMTP.start(server, port, domain, acct, passwd, authtype)参数解释 
转载自:http://www.iceskysl.com/posts/633