gpt4 book ai didi

ruby - Mandrill - 不存在具有 id 的消息

转载 作者:数据小太阳 更新时间:2023-10-29 08:08:47 24 4
gpt4 key购买 nike

我在使用适用于 ruby​​ 的 mandrill API 时遇到问题,我不确定是不是我对 ruby​​/api 缺乏了解,如果 mandrill api 存在问题。

我有使用 mandrill 发送电子邮件的方法,然后我使用从 mandrill.messages.send 返回的 id 进行另一个 api 调用,以再次调用 mandrill 以获取电子邮件标题 message-id 这样我就可以将其存储在数据库表中。

为什么我收到错误 Mandrill::UnknownMessageError (No message exists with the id '64fba1cce24942dea1ada4f905fd7871'): 当 id 清楚地存在于记录事件的注释中时?

# Sends an email to all users for the account_id on the issue
def send_email

require 'mandrill'

...

mandrill = Mandrill::API.new Mandrill::API_KEY

# Email contents
message = {
:subject => self.name,
:from_name => self.account.subdomain,
:text => self.description,
:to => [{
:email => user.email,
:name => user.name
}],
:text => self.description,
:from_email => "noreply@myapp.com",
:headers => {
'reply-to' => 'update@myapp.com'
}
}

results = mandrill.messages.send message # Send email through mandrill

# Loop through results of sent email
results.each do |result|

logger.debug "result id = #{result['_id']}" # LOGS result id = 64fba1cce24942dea1ada4f905fd7871
logger.debug "result = #{result}" # LOGS result = {"email"=>"tomcaflisch@gmail.com", "status"=>"sent", "_id"=>"64fba1cce24942dea1ada4f905fd7871", "reject_reason"=>nil}

id = result['_id'] # Mandrill's internal id from api call results that sent the email

# CAUSES Mandrill::UnknownMessageError (No message exists with the id '64fba1cce24942dea1ada4f905fd7871'):
info = mandrill.messages.content id # Get info for sent email with a specific mandrill id

end
end

最佳答案

我认为你只需要给它一点时间。

关于ruby - Mandrill - 不存在具有 id 的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23880127/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com