Browse Source

allow different <mail> tasks to use different smtp hosts. PR 37970.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@695827 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
78f58cb78a
2 changed files with 8 additions and 5 deletions
  1. +4
    -0
      WHATSNEW
  2. +4
    -5
      src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java

+ 4
- 0
WHATSNEW View File

@@ -218,6 +218,10 @@ Fixed bugs:
sigfile attribute.
Bugzilla Report 44805.

* When using JavaMail all <mail> tasks used the same mail host
regardless of their configuration.
Bugzilla Report 37970.

Other changes:
--------------



+ 4
- 5
src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java View File

@@ -136,7 +136,7 @@ public class MimeMailer extends Mailer {
// 'session', which involves excessive quantities of
// alcohol :-)
Session sesh;
Authenticator auth;
Authenticator auth = null;
if (SSL) {
try {
Provider p = (Provider) Class.forName(
@@ -151,13 +151,12 @@ public class MimeMailer extends Mailer {
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
props.put("mail.smtp.socketFactory.fallback", "false");
}
if (user == null && password == null) {
sesh = Session.getDefaultInstance(props, null);
} else {
if (user != null || password != null) {
props.put("mail.smtp.auth", "true");
auth = new SimpleAuthenticator(user, password);
sesh = Session.getInstance(props, auth);
}
sesh = Session.getInstance(props, auth);

//create the message
MimeMessage msg = new MimeMessage(sesh);
MimeMultipart attachments = new MimeMultipart();


Loading…
Cancel
Save