我正在尝试使用Python使用Mandrill创建发送模板。该代码运行正常,但即时状态为“已排队”,而不是“已发送”。
我的代码:
import mandrill
MANDRILL_API_KEY = 'API-KEY'
email = 'email@example.com'
myEmail = 'email@example.com'
subjectMessage = 'Hi| Welcome Message'
template_content = [{'content': subjectMessage, 'name': 'SUBJECT'}]
mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
message = {'to': [{
'email': myEmail,
'name': 'Dear Applicant:',
'type': 'to'
}],
'subject': subjectMessage,
'from_email': email
}
#result = mandrill_client.messages.send(message = message)
result = mandrill_client.messages.send_template(
template_name='test-template', template_content=template_content, message=message, async=False, ip_pool=None, send_at=None)
# result is a dict with metadata about the sent message, including
# if it was successfully sent
print(result)
'''
[{'_id': 'abc123abc123abc123abc123abc123',
'email': 'recipient.email@example.com',
'reject_reason': 'hard-bounce',
'status': 'sent'}]
'''
答案 0 :(得分:0)
更新:我的代码运行正常。我的帐户是试用版...所以一定要支付山to