Skip to content
Permalink
Browse files
Fix JENKINS-13102
Added a try/catch around address resolution for each user.
  • Loading branch information
slide committed May 22, 2012
1 parent 13270a1 commit f4f5cf9ebad1e14602cb5e70e17fdf7cb2ea6691
Showing with 9 additions and 7 deletions.
  1. +9 −7 src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
@@ -356,9 +356,7 @@ private MimeMessage createMail(EmailType type, AbstractBuild<?, ?> build, BuildL
}

// Set the contents of the email

msg.setSentDate(new Date());

setSubject(type, build, msg, listener, charset);

Multipart multipart = new MimeMultipart();
@@ -393,11 +391,15 @@ private MimeMessage createMail(EmailType type, AbstractBuild<?, ?> build, BuildL
}
}
for (User user : users) {
String adrs = user.getProperty(Mailer.UserProperty.class).getAddress();
if (adrs != null) {
addAddressesFromRecipientList(recipientAddresses, adrs, env, listener);
} else {
listener.getLogger().println("Failed to send e-mail to " + user.getFullName() + " because no e-mail address is known, and no default e-mail domain is configured");
try {
String adrs = user.getProperty(Mailer.UserProperty.class).getAddress();
if (adrs != null) {
addAddressesFromRecipientList(recipientAddresses, adrs, env, listener);
} else {
listener.getLogger().println("Failed to send e-mail to " + user.getFullName() + " because no e-mail address is known, and no default e-mail domain is configured");
}
} catch(Exception e) {
listener.getLogger().println("Failed resolving e-mail address for " + user.getFullName() + " because of an exception in the resolving process (" + e.getMessage() + ")");
}
}
}

0 comments on commit f4f5cf9

Please sign in to comment.