我有这个代码:
require "net/smtp"
MAIL_SERVER = "xxx.ad.xxx.net"
def lib_sending_report(email_hash)
# define message body
message = <<"MESSAGE_END"
From: <#{email_hash[:sender]}>
To: <#{email_hash[:recipients]}>
MIME-Version: 1.0
Content-type: text/html
Subject: #{email_hash[:subject]}
<p>Hi All,</p>
<p>We've just executed a round of load test.</p>
<p>Regards</p>
MESSAGE_END
Net::SMTP.start(MAIL_SERVER) do |smtp|
smtp.send_message message, email_hash[:sender], email_hash[:recipients]
end
end
test = ""
lib_sending_report( {:sender => "abc@xxx.com",
:recipients => "abc@xxxx.com",
:subject => "Load.Test.Report.of.#{test}"} )
当我更改:recipients => "abc@xxxx.com"
为 时:recipients => "abc@xxxx.com;efg@xxx.com"
,它给了我这个错误:
501 5.5.4 Invalid Address (Net::SMTPSyntaxError)
:recipients => "abc@xxxx.com"
只有一个收件人时,我可以成功发送电子邮件。
我哪里错了?看来我使用的分隔符(分号)是错误的。
我尝试使用逗号代替分号,但没有用