Code changed in jenkins
User: Johannes Weißl
Path:
src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java
src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java
src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/config.groovy
src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/global.groovy
src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/help-tokens.groovy
src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/help-tokens.properties
src/main/resources/hudson/plugins/emailext/templates/Jive-Formatter-README.md
src/main/resources/hudson/plugins/emailext/templates/jive-formatter.groovy
src/main/webapp/help/globalConfig/defaultClasspath.html
src/main/webapp/help/globalConfig/defaultPostsendScript.html
src/main/webapp/help/globalConfig/security.html
src/main/webapp/help/projectConfig/defaultClasspath.html
src/main/webapp/help/projectConfig/postsendScript.html
src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherTest.java
src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java
src/test/java/hudson/plugins/emailext/plugins/content/TriggerNameContentTest.java
src/test/postsend/hudson/plugins/emailext/ExtendedEmailPublisherTestHelper.groovy
src/test/resources/recipient-provider-upgrade.xml
src/test/resources/recipient-provider-upgrade2.xml
http://jenkins-ci.org/commit/email-ext-plugin/8c0c532a524f14730ad221a9d15f98c6341bbd37
Log:
Add post-send script feature
For some tasks pre-send scripts are not sufficient, like rewriting the
Message-ID based on the SMTP response for later In-Reply-To headers.
This is needed when using Amazon Simple Email Service (AWS SES) for
sending emails.
Other possible use cases are scripts that act upon failed sending
attempts.
Here is a example post-send script that does the message id rewriting
for AWS SES:
```groovy
import com.sun.mail.smtp.SMTPTransport;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hudson.plugins.emailext.ExtendedEmailPublisherDescriptor;
String smtpHost = props.getProperty("mail.smtp.host", "");
String awsRegex = "^email-smtp\\.([a-z0-9-]+)\\.amazonaws\\.com\$";
Pattern p = Pattern.compile(awsRegex);
Matcher m = p.matcher(smtpHost);
if (m.matches()) {
String region = m.group(1);
if (transport instanceof SMTPTransport) {
String response = ((SMTPTransport)transport).getLastServerResponse();
String[] parts = response.trim().split(" +");
if (parts.length == 3 && parts[0].equals("250") && parts[1].equals("Ok"))
{
String MessageID = "<" + parts[2] + "@" + region + ".amazonses.com>";
msg.setHeader("Message-ID", MessageID);
}
}
}
```
References:
Please submit a pull request so I can review there, it's much easier.