You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/09/16 14:20:13 UTC
svn commit: r695827 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
Author: bodewig
Date: Tue Sep 16 05:20:12 2008
New Revision: 695827
URL: http://svn.apache.org/viewvc?rev=695827&view=rev
Log:
allow different <mail> tasks to use different smtp hosts. PR 37970.
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=695827&r1=695826&r2=695827&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Sep 16 05:20:12 2008
@@ -218,6 +218,10 @@
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:
--------------
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java?rev=695827&r1=695826&r2=695827&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java Tue Sep 16 05:20:12 2008
@@ -136,7 +136,7 @@
// '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 @@
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();