繁体   English   中英

詹金斯:从 python 发送电子邮件

[英]Jenkins: send email from python

如何使用 Jenkins 工作中的 python 代码发送电子邮件? 我有 Groovy-DSL“emailext”的 SMTP 配置,我可以完成; 但是试图用 python 代码看到相同的内容。

简单的例子:

import smtplib
sender = "sender@domain.com"  
receivers = "receivers@domain.com"  
message = """
Stack Overflow! 
"""

try:
   smtp_obj = smtplib.SMTP('localhost')
   smtp_obj.sendmail(sender, receivers, message)         
   print "Done"
except SMTPException:
   print "error"

你可以阅读这个

https://www.tutorialspoint.com/python/python_sending_email.htm

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM