无法从Ruby上的Mandrill发送邮件
您好,我是Ruby on Rails上的新手,我正在尝试从Mandrill发送邮件,然后遵循此文档 https://mailchimp.com/developer/transactional/guides/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: "[email protected]",
subject: "Hello world",
text: "Welcome to Mailchimp Transactional!",
to: [
{
email: "[email protected]",
type: "to"
}
]
}
begin
response = client.messages.send(message)
p response
rescue MailchimpTransactional::ApiError => e
puts "Error: #{e}"
end
Hello I am newbie to ruby on rails, I am trying to send mail from mandrill and following this documentation https://mailchimp.com/developer/transactional/guides/send-first-email/
but somehow I am getting this error
Error: {:status=>500, :response_body=>"{\"status\":\"error\",\"code\":-1,\"name\":\"ValidationError\",\"message\":\"You must specify a message value\"}"}
here is my code
client = MailchimpTransactional::Client.new('xxxxxxxxxRWX-nA')
message = {
from_email: "[email protected]",
subject: "Hello world",
text: "Welcome to Mailchimp Transactional!",
to: [
{
email: "[email protected]",
type: "to"
}
]
}
begin
response = client.messages.send(message)
p response
rescue MailchimpTransactional::ApiError => e
puts "Error: #{e}"
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您必须将其传递给客户,并具有以下消息的关键值:
这是不正确的:
这是正确的:
mailchimp的网站不正确。
That's because you have to pass it to the client with a key value of message as follows:
This is incorrect:
This is correct:
The transactional email documentation on Mailchimp's website is incorrect.