我试图用Mandrill使用Python创建一个发送模板。代码运行正常,但我得到一个'排队'状态而不是'已发送'。
我的代码:
import mandrill
MANDRILL_API_KEY = 'API-KEY'
email = '[email protected]'
myEmail = '[email protected]'
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': '[email protected]',
'reject_reason': 'hard-bounce',
'status': 'sent'}]
'''
更新:我的代码工作正常。我的帐户是试用版...所以一定要支付mandrill