Mail class now support authentication for SMTP

git-svn-id: https://svn.libreccm.org/ccm/trunk@3958 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2016-03-24 12:08:23 +00:00
parent 3ae76d3d39
commit 4858e92f0a
1 changed files with 7 additions and 0 deletions

View File

@ -264,6 +264,13 @@ public class Mail implements MessageType {
throws MessagingException,
SendFailedException {
Transport transport = getSession().getTransport();
Properties properties = getConfig().getJavamail();
if ("true".equals(properties.getProperty("mail.smtp.auth"))) {
transport.connect(properties.getProperty("mail.smtp.user"),
properties.getProperty("mail.smtp.password"));
} else {
transport.connect();
}
transport.connect();
send(transport);
transport.close();