Author: bodewig
Date: Mon Oct 27 08:16:14 2008
New Revision: 708217

URL: http://svn.apache.org/viewvc?rev=708217&view=rev
Log:
Make <mail> work for SSL + authentication with javamail 1.4.1.  PR 46063.  
Submitted by Craig Richardson

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=708217&r1=708216&r2=708217&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Oct 27 08:16:14 2008
@@ -274,6 +274,10 @@
    work as TaskContainers at the same time.
    Bugzilla Report 41647.
 
+ * combining SSL and authentication in <mail> and MailLogger failed in
+   some setups.
+   Bugzilla Report 46063.
+
 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=708217&r1=708216&r2=708217&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 
Mon Oct 27 08:16:14 2008
@@ -247,7 +247,10 @@
             }
             msg.setContent(attachments);
             try {
-                Transport.send(msg);
+                // Send the message using SMTP, or SMTPS if the host uses SSL
+                Transport transport = sesh.getTransport(SSL ? "smtps" : 
"smtp");
+                transport.connect(host, user, password);
+                transport.sendMessage(msg, msg.getAllRecipients());
             } catch (SendFailedException sfe) {
                 if (!shouldIgnoreInvalidRecipients()) {
                     throw new BuildException(GENERIC_ERROR, sfe);


Reply via email to