【问题标题】:How to configure Jenkins to send encrypted emails with gpg?如何配置 Jenkins 以使用 gpg 发送加密电子邮件?
【发布时间】:2012-08-22 16:24:14
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    此类功能不是开箱即用的,您需要自定义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)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-28
      • 2019-12-01
      • 1970-01-01
      • 2016-06-08
      • 1970-01-01
      • 1970-01-01
      • 2010-10-10
      相关资源
      最近更新 更多