[英]Jenkins: send email from python
How to send email utilizing python code from Jenkins job?如何使用 Jenkins 工作中的 python 代码发送电子邮件? I have SMTP configuration with Groovy-DSL "emailext", I can accomplish it;
我有 Groovy-DSL“emailext”的 SMTP 配置,我可以完成; But trying to see the same with python code.
但是试图用 python 代码看到相同的内容。
Simple example:简单的例子:
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"
You can read this你可以阅读这个
https://www.tutorialspoint.com/python/python_sending_email.htm https://www.tutorialspoint.com/python/python_sending_email.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.