简体   繁体   English

詹金斯可以发送多封电子邮件吗?

[英]Can Jenkins send more than one email?

After the build I want to trigger two e-mails. 构建之后我想触发两封电子邮件。

The first one is an email to SharePoint server. 第一个是发送给SharePoint服务器的电子邮件。 SharePoint uploads its attachments. SharePoint上载其附件。 The subject of this mail must match a SharePoint folder for uploading. 此邮件的主题必须与SharePoint文件夹匹配才能上载。

The second one is a mail for team. 第二个是团队邮件。 So, it should have nice subject rather than folder name. 所以,它应该有一个很好的主题而不是文件夹名称。

How can I make Jenkins send two emails? 如何让詹金斯发送两封电子邮件?

There is no plugin that provides this functionality. 没有提供此功能的插件。 You have two choices to accomplish this functionality. 您有两种选择来完成此功能。 You could implement your own plugin. 你可以实现自己的插件。 A good place to start would probably be the email-ext plugin . 一个好的起点可能是email-ext插件

Alternatively, you could trigger the first email with the actual build and then have Jenkins trigger a separate, dummy build that sends the second email. 或者,您可以使用实际构建触发第一封电子邮件,然后让Jenkins触发另一个发送第二封电子邮件的虚拟构建。 This wouldn't be as elegant, but much easier as you wouldn't need to implement any functionality yourself. 这不会那么优雅,但更容易,因为您不需要自己实现任何功能。 Depending on what exactly you want the emails to contain, you might have to transfer some data from the first to the second build (eg via a parameterized build). 根据您希望电子邮件包含的确切内容,您可能必须将一些数据从第一个构建转移到第二个构建(例如,通过参数化构建)。

A cheap alternative is to create "shell script" Build steps, eg: (if on *nix platforms) 一个便宜的替代方案是创建“shell脚本”构建步骤,例如:(如果在* nix平台上)

echo "Please Mr. SharePoint, would you be so kind to attach my file(s) ? 
      Thanks!" | mail -s "<folder name>" -a ${WORKSPACE}/target/artifacts/myfile sharepoint@example.com

您还可以添加新触发器,并可选择将包含新内容的新电子邮件发送到收件人列表。

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

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