Ruby发送邮件(163信箱)
Ruby发送邮件(163邮箱)Ruby1.8.6发送163邮件到gmailrequire net/smtpmsg [ Subject: Test\n, \n,
Ruby发送邮件(163邮箱)
Ruby1.8.6发送163邮件到gmail
require 'net/smtp'msg = [ "Subject: Test\n", "\n", "Now is the time\n" ]Net::SMTP.start( 'smtp.163.com', 25, "163.com", "caiwenhn2008@163.com", "******", :login ) do |smtp| smtp.sendmail( msg, 'caiwenhn2008@163.com', 'caiwenhn2008@gmail.com' )end
Net::SMTP.start(server, port, domain, acct, passwd, authtype)参数解释
server163 smtp服务器域名port163 smtp服务器端口domain163 email服务器域,就是@符号后面的字符串acct163邮箱用户名passwd163邮箱密码authtype邮件发送验证方式,163是密码验证
smtp.sendmail(msg, from, to)参数解释
msgmessage主题和内容from从哪个邮件帐号发送to发送到哪个邮件帐号,我这里发送到我的gmail邮箱