我正在将Mailjet集成到我的Google应用程序引擎应用程序中。我可以成功地从本地开发服务器发送电子邮件。 但是,当我部署应用程序并尝试发送电子邮件时,Mailjet客户端库显然在尝试连接到Mailjet rest API时出错。你知道吗
由NewConnectionError(':未能建立新连接:[Errno-3]名称解析中的临时故障'
我基本上是按照
https://cloud.google.com/appengine/docs/standard/python/mail/sending-messages
和
https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27
我为集成mailjet添加的代码。
要求.txt地址:
certifi==2019.6.16
chardet==3.0.4
idna==2.8
mailjet-rest==1.3.3
requests==2.22.0
urllib3==1.25.3
你知道吗附录yaml地址:
...
libraries:
- name: ssl
version: latest
你知道吗主.py地址:
from mailjet_rest import Client
...
#calling this function to send email
def mailjet_sendmail(to_address, subject, body):
api_key = '***'
api_secret = '***'
mailjet = Client(auth=(api_key, api_secret), version='v3.1')
data = {
'Messages': [
{
"From": {
"Email": "noreply@mydomain.com",
"Name": "mydomain.com"
},
"To": [
{
"Email": to_address,
}
],
"Subject": subject,
"TextPart": body,
}
]
}
result = mailjet.send.create(data=data)
当我打电话的时候mailjet.send.create创建,错误日志中显示以下异常:
ApiError: HTTPSConnectionPool(host='api.eu.mailjet.com', port=443): Max retries exceeded with url: /v3.1/send (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x2a66ef5e1950>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
at api_call (/base/data/home/apps/s~***/20190828t114640.420634513089712020/mailjet_rest/client.py:110)
at create (/base/data/home/apps/s~***/20190828t114640.420634513089712020/mailjet_rest/client.py:62)
at mailjet_sendmail (/base/data/home/apps/s~***/20190828t114640.420634513089712020/main.py:80)
at post (/base/data/home/apps/s~***/20190828t114640.420634513089712020/main.py:379)
...
看来解决不了api.eu.mailjet公司网站。你知道吗
我需要做什么才能在googleappengine中启用DNS查找?有人能举一个完全可行的例子吗?你知道吗
请注意,在运行本地开发服务器的我的PC上运行的代码完全相同。你知道吗
谢谢
弗雷德
在进一步搜索之后,我实际上找到了我自己问题的答案。你知道吗
唯一的问题是,没有任何帐单帐户与该项目相关联。其余的都做对了。你知道吗
希望这能帮助别人。你知道吗
弗雷德
相关问题 更多 >
编程相关推荐