从Azure服务器使用python脚本发送电子邮件

loading...


-1

使用python脚本,我正在尝试发送电子邮件 . 脚本的邮件部分看起来像 -

import smtplib
sender = 'abc.xyz@company.com'
receiver = 'abc.xyz@company.com'
message = """From: From Person <abc.xyz@company.com>
To: To Person <abc.xyz@company.com>
Subject: Inbound Folder Check - Alert
Unchanged even after an hour, please check
"""
smtpObj = smtplib.SMTP('smtp.office365.com',587)
smtpObj.starttls()
smtpObj.login('def@company.onmicrosoft.com','Password')
smtpObj.sendmail(sender, receiver, message)

我得到的错误是 -

raise SMTPDataError(code,resp)smtplib.SMTPDataError:(554,b'5.2.0 STOREDRV.Submission.Exception:SendAsDeniedE xception.MapiExceptionSendAsDenied;由于永久异常消息无法处理消息无法提交消息 . ..., 20.52176:140FCC8414001010640 10000,20.50032:140FCC848417101069010000,0.35180:0A006586,255.23226:6E010000,255.27962:0A000000,255.27962:0E000000,255.31418:0A00EB87,16.55847:69000000,1 7.43559:0000000090010000000000000D00000000000000,20.52176:140FCC84140010100A00F 736 20.50032:140FCC84841710100A00F836,0.35180:8C010000 ,255.23226:40000730,25 5.27962:32000000,255.17082:DC040000,0.27745:9A010000,4.21921:DC040000,255.27 962:FA000000,255.1494:0A00070E,0.37692:01000100,0.44092:01000100,0.41232:010 00100,0.60208:01000100,0.37136: 01000100,0.34608:01000100,0.55056:01000100,0.42768:01000100,0.56112:05000780,0.52807:00000000,4.33016:DC040000,7.40748:0 10000000000010C00000000,7.57132:000000000000000005000780,1.63016:32000000, 4.3 9640:DC040000,8.45434:EC5537826FAD8844ABBA433565F1D57205000780,5.10786:0000000 031352E32302E313232382E3032303A564931505230314D42323939303A38616433323065392D646 338612D343530642D386265322D62646464616261333932613900602005000780,255.1750:4B01 0000,255.31418:0A004C82,0.22753:50010000,255.21817:DC040000,4.60547:DC040000,0.21966:B4100000,4.30158:DC040000 [主机名= ABC]')

只有我上网的帮助是从页面 - https://support.microsoft.com/en-us/help/3132755/554-5-2-0-storedrv-deliver-exception-objectnotfoundexception-mapiexcep它似乎说杂乱已启用但文件夹不存在于邮箱中,并建议关闭杂乱选项,这没有帮助 .

PS - 这可以在我公司网络中的本地计算机上运行,但它与从Azure服务器运行它有关 .

loading...

1回答
评论

暂时没有评论!