你好,我是ruby on rails的新手,我试图从mandrill发送邮件,并遵循此文档https://mailchimp.com/developer/transactional/guides/send-first-email/,但不知何故,我得到了这个错误
Error: {:status=>500, :response_body=>"{\"status\":\"error\",\"code\":-1,\"name\":\"ValidationError\",\"message\":\"You must specify a message value\"}"}
这是我的代码
client = MailchimpTransactional::Client.new('xxxxxxxxxRWX-nA')
message = {
from_email: "hello@xxxxx.co",
subject: "Hello world",
text: "Welcome to Mailchimp Transactional!",
to: [
{
email: "xxxxxx@gmail.com",
type: "to"
}
]
}
begin
response = client.messages.send(message)
p response
rescue MailchimpTransactional::ApiError => e
puts "Error: #{e}"
end
1条答案
按热度按时间kyks70gy1#
这是因为您必须将其传递给客户端,其键值为message,如下所示:
这是不正确的:
这是正确的:
Mailchimp网站上的交易电子邮件文档不正确。