在Jenkins中发送电子邮件,其中包含文件内容中的正文 [英] Sending email in Jenkins with body from content in file

查看:869
本文介绍了在Jenkins中发送电子邮件,其中包含文件内容中的正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了一些插件来发送邮件. 我只有2个文件:

Ive downloaded plugin for jenkings to sending emails. What I have is 2 files:

ReleaseNotes.txt
config.properties

第一个包含纯文本的发行说明,第二个包含与属性文件相同的发行说明. 我可以通过此插件将它们作为附件发送,但我希望将其内容添加为邮件内容.

The first one contains release notes in plain text, the second one contains the same release notes as properties file. I can send them as attachment via this plug in, but I wish to add the content as mail content.

选项1:以某种方式将ReleaseNotes.txt的内容添加到我的邮件中

选项2:从config.properties中设置新的环境变量并将其添加到邮件中.

其他选项之一会让我满意,您能帮我一个选项吗?在您的答复中不仅请给我发送插件链接,还要实际帮助我并说明如何实现.我看到了一些插件,但是我在使用它们时遇到了困难.

Esther one of the options will satisfy me, can you please help me with one of them? In your answer please not just send me link to plugin but actually help me and explain how to achieve it. I saw some plugins but I struggled using them.

推荐答案

您应该能够结合环境脚本插件,带有电子邮件扩展插件以实现所需的功能.

You should be able to combine Environment Script plugin with Email-ext plugin to achieve the desired functionality.

检查构建环境"部分中的通过脚本生成环境变量"选项.

Check the generate environment variable from script option in the build environment section.

然后创建脚本以读取文件内容,如下所示:

Then create the script to read the file content, like this:

echo RELEASE_NOTES=$(cat ReleaseNotes.txt)

在扩展的电子邮件通知配置部分,用您最近创建的变量$RELEASE_NOTES

In the extended email notification configurations section, fill the default content field with your recently created variable $RELEASE_NOTES

这篇关于在Jenkins中发送电子邮件,其中包含文件内容中的正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆