0
我已經通過Mailgun,[email protected]設置了一個郵件列表。當我使用我的Mailgun API密鑰向此地址發送郵件時,郵件將發送給郵件列表的所有成員。Mailgun郵件列表地址反彈
核心問題是: Mailgun還試圖將郵件傳遞到[email protected]本身,這是一個不存在的郵箱地址,每天
Failed: [email protected] → [email protected] 'Morning Report: 2017-05-12' Not delivering to previously bounced address
導致我們的日誌下面的錯誤
我可以簡單地忽略這一點,但它確實會對我們的分析產生偏差,並且使我們很難注意到有意義的錯誤,因爲它每次都顯示反彈。我如何解決這個問題,以便在發送到我們的郵件列表時不會導致此反彈錯誤?我的(寫得不好)Python代碼如下。謝謝!
def standard_message(key, to, from_email, from_name, subject, body, delivery_time=False, replyto=False):
url = "https://api.mailgun.net/v3/tradedefender.com/messages"
auth = ("api", key)
data = {"from": from_name + " <" + from_email + ">",
"to": to,
"subject": subject,
"text": body}
if(delivery_time != False):
data["o:deliverytime"] = delivery_time
if(replyto != False):
data["h:Reply-To"] = replyto
response = requests.post(url, auth=auth, data=data)
if("200" in str(response)):
return(True)
else:
raise Exception(response)
我沒有檢查,並在我們的任何郵件列表中沒有找到它。儘管如此,我還是沒有想到要這麼做,這麼好的建議。 –