admin管理员组文章数量:1564701
文章目录
- 腾讯企业邮箱设置
- jenkins
- 1. 安装Email Extension Plugin
- 2. 配置管理员邮箱
- 3. 配置smtp验证
- 4. 通过pipeline发送邮件
- 1. declarative pipeline
- 2. 脚本方式
- 更多
构建时可能出现错误,想着jenkins可以发送邮件。通常情况下,仓库的维护者或负责代码的开发者接受这个邮件。这篇文章记录下如何将邮件群发到腾讯企业邮箱。
腾讯企业邮箱设置
jenkins
1. 安装Email Extension Plugin
2. 配置管理员邮箱
系统配置-> Jenkins Location
管理员邮箱将作为发送人
3. 配置smtp验证
一般你需要选择一个smtp服务器,负责发送你的邮件。
选择 系统配置->Extended E-mail Notification
4. 通过pipeline发送邮件
1. declarative pipeline
pipeline {
agent any
environment {
GIT_URL = "http://sample.git"
MAINTAINER = "zhangsan,lisi"
}
stages {
stage('Hello') {
steps {
sh 'exit 1'
}
}
}
post{
failure {
// @qq是你配的默认后缀名,会自动加上去
// 这样配置会群发给zhangsan@qq lisi@qq
emailext body: "hello", subject: 'world', to: "${MAINTAINER}"
}
}
}
2. 脚本方式
pipeline {
agent any
environment {
GIT_URL = "http://sample.git"
MAINTAINER = "zhangsan,lisi"
}
stages {
stage('Hello') {
steps {
sh 'exit 1'
}
}
}
post{
failure {
script {
// 这里需要什么内容自己去拼字符串,subject是主题,body是内容,
// to是邮件列表,","分割
def hello = "hello world"
emailext body: "$hello", subject: 'world', to: "${MAINTAINER}"
}
}
}
}
上面两种方式你都可以收到"hello world"
更多
你可以编写自己的邮件模板,
官方文档参考意义不大:
https://plugins.jenkins.io/email-ext/
我找了一个能用的:
https://blog.csdn/weixin_33694620/article/details/92637403
版权声明:本文标题:Jenkins发送email至腾讯企业邮箱 Pipeline方式 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1727422708a1113762.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论