From 491cd1e2d8436285603646db6719219f5c4a3601 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 27 Oct 2008 15:16:14 +0000 Subject: [PATCH] Make work for SSL + authentication with javamail 1.4.1. PR 46063. Submitted by Craig Richardson git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@708217 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 4 ++++ src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index aad6c2f64..ac34cb08b 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -274,6 +274,10 @@ Fixed bugs: work as TaskContainers at the same time. Bugzilla Report 41647. + * combining SSL and authentication in and MailLogger failed in + some setups. + Bugzilla Report 46063. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java b/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java index 931345281..60641b51f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java +++ b/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java @@ -247,7 +247,10 @@ public class MimeMailer extends Mailer { } 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);