问题
I am looking for instructions on how to configure the jenkins email plugin (ext-mail) to encrypt notifications? The uncle google did not help me too much.
回答1:
such feature is not out-of-box, you need custom ExtendedEmailPublisher for your needs.
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;
}
you can get Recipients and Email message for sign/encrypt and call Transport.send(msg) at last.
来源:https://stackoverflow.com/questions/12154558/how-to-configure-jenkins-to-send-encrypted-emails-with-gpg