|
|
|
@ -39,6 +39,8 @@ import java.util.List;
|
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Properties; |
|
|
|
|
|
|
|
|
|
import javax.activation.CommandMap; |
|
|
|
|
import javax.activation.MailcapCommandMap; |
|
|
|
|
import javax.mail.Authenticator; |
|
|
|
|
import javax.mail.Message; |
|
|
|
|
import javax.mail.MessagingException; |
|
|
|
@ -284,6 +286,15 @@ public class MailSender {
|
|
|
|
|
* @return the new Session |
|
|
|
|
*/ |
|
|
|
|
private Session getSession() { |
|
|
|
|
// support multilple email format
|
|
|
|
|
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); |
|
|
|
|
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); |
|
|
|
|
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); |
|
|
|
|
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); |
|
|
|
|
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); |
|
|
|
|
mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); |
|
|
|
|
CommandMap.setDefaultCommandMap(mc); |
|
|
|
|
|
|
|
|
|
Properties props = new Properties(); |
|
|
|
|
props.setProperty(MailParamsConstants.MAIL_SMTP_HOST, mailSmtpHost); |
|
|
|
|
props.setProperty(MailParamsConstants.MAIL_SMTP_PORT, mailSmtpPort); |
|
|
|
|