如何配置Jenkins使用gpg发送加密的电子邮件?

时间:2012-08-28 07:20:53

标签: jenkins public-key-encryption gnupg jenkins-plugins

我正在寻找有关如何配置jenkins电子邮件插件(ext-mail)来加密通知的说明?叔叔谷歌并没有太多帮助我。

1 个答案:

答案 0 :(得分:2)

此功能不是开箱即用的,您需要自定义ExtendedEmailPublisher以满足您的需求。

        MimeMessage msg = createMail(mailType, build, listener);
        Address[] allRecipients = msg.getAllRecipients();
        if (allRecipients != null) {
            StringBuilder buf = new StringBuilder("Sending email to:");
            for (Address a : allRecipients) {
                buf.append(' ').append(a);
            }
            listener.getLogger().println(buf);
            Transport.send(msg);
            if (build.getAction(MailMessageIdAction.class) == null) {
                build.addAction(new MailMessageIdAction(msg.getMessageID()));
            }
            return true;
        }

您可以获取签名/加密的收件人和电子邮件,并最后调用Transport.send(msg)。