From 7307d20a4542ea42a9eaa2876e9371e71101c285 Mon Sep 17 00:00:00 2001 From: dustoair <107600816+dustoair@users.noreply.github.com> Date: Mon, 15 Aug 2022 12:21:21 +0800 Subject: [PATCH] Extended-Email-Publisher --- Jenkinsfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3c9ba9b..8ed6be4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,23 @@ pipeline { //} stages { + stage('email'){ + echo "测试发送邮件" + // 设置生成模板文件 + configFileProvider([configFile(fileId: ' Extended-Email-Publisher', + targetLocation: 'email.html', + variable: 'failt_email_template')]) { + // 读取模板 + template = readFile encoding: 'UTF-8', file: "${failt_email_template}" + // 发送邮件 + emailext(subject: '任务执行失败', + attachLog: true, + recipientProviders: [requestor()], + to: '32*****47@qq.com', + body: """${template}""") + } + } + stage('Build') { steps { sh 'echo "Hello World"'