public class Smtp
extends java.lang.Object
implements org.ow2.chameleon.mail.MailSenderService
| Modifier and Type | Class and Description |
|---|---|
static class |
Smtp.Connection
Type of connections.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CONFAUTH |
private static java.lang.String |
CONFHOST |
(package private) org.wisdom.api.configuration.ApplicationConfiguration |
configuration |
private static java.lang.String |
CONFPORT |
protected Smtp.Connection |
connection |
private boolean |
debug
Enables / Disabled debugging.
|
static java.lang.String |
DEFAULT_FROM |
protected java.lang.String |
from
The mail address of the sender.
|
protected java.lang.String |
fromName
An optional name (for the sender).
|
protected java.lang.String |
host
The host.
|
private static org.slf4j.Logger |
LOGGER |
static java.lang.String |
MOCK_SERVER_NAME |
protected java.lang.String |
password
The password.
|
protected int |
port
The port.
|
private java.util.Properties |
properties
Configuration properties.
|
private static java.lang.String |
SEPARATOR |
private javax.mail.Authenticator |
sslAuthentication
The authenticator used for SSL.
|
protected boolean |
useMock
True we should use the mock server.
|
protected java.lang.String |
username
The username.
|
protected java.lang.Boolean |
useSmtps |
| Constructor and Description |
|---|
Smtp() |
| Modifier and Type | Method and Description |
|---|---|
private void |
addBodyToMessage(org.ow2.chameleon.mail.Mail mail,
javax.mail.internet.MimeMessage msg) |
protected void |
configure()
Configures the sender.
|
static javax.mail.internet.InternetAddress[] |
convert(java.util.List<java.lang.String> addresses)
Converts the list of addresses to an array of
InternetAddress. |
private void |
manageConnectionType() |
void |
reconfigure() |
void |
send(org.ow2.chameleon.mail.Mail mail)
Sends the given mail object.
|
void |
send(java.lang.String to,
java.lang.String cc,
java.lang.String subject,
java.lang.String body)
Sends a mail.
|
void |
send(java.lang.String to,
java.lang.String cc,
java.lang.String subject,
java.lang.String body,
java.util.List<java.io.File> attachments)
Sends a mail.
|
private void |
sendMessageWithMockServer(org.ow2.chameleon.mail.Mail mail,
javax.mail.internet.MimeMessage msg)
Prints the mail info with the logger.
|
private static final org.slf4j.Logger LOGGER
public static final java.lang.String MOCK_SERVER_NAME
public static final java.lang.String DEFAULT_FROM
private static final java.lang.String CONFHOST
private static final java.lang.String CONFPORT
private static final java.lang.String CONFAUTH
private static final java.lang.String SEPARATOR
org.wisdom.api.configuration.ApplicationConfiguration configuration
private java.util.Properties properties
private boolean debug
protected java.lang.String from
protected java.lang.String fromName
protected int port
protected java.lang.String host
protected java.lang.String username
protected java.lang.String password
private javax.mail.Authenticator sslAuthentication
protected boolean useMock
protected java.lang.Boolean useSmtps
protected Smtp.Connection connection
protected void configure()
private void manageConnectionType()
public void reconfigure()
public void send(java.lang.String to,
java.lang.String cc,
java.lang.String subject,
java.lang.String body)
throws java.lang.Exception
send in interface org.ow2.chameleon.mail.MailSenderServiceto - tocc - ccsubject - subjectbody - bodyjava.lang.Exception - if the mail cannot be sent.MailSenderService.send(java.lang.String, java.lang.String,
java.lang.String, java.lang.String)public void send(java.lang.String to,
java.lang.String cc,
java.lang.String subject,
java.lang.String body,
java.util.List<java.io.File> attachments)
throws java.lang.Exception
send in interface org.ow2.chameleon.mail.MailSenderServiceto - tocc - ccsubject - subjectbody - bodyattachments - list of attachmentsjava.lang.Exception - if the mail cannot be sentMailSenderService.send(java.lang.String, java.lang.String, java.lang.String,
java.lang.String, java.util.List)public void send(org.ow2.chameleon.mail.Mail mail)
throws javax.mail.MessagingException
send in interface org.ow2.chameleon.mail.MailSenderServicemail - the mailjavax.mail.MessagingException - if the mail cannot be sent.private void addBodyToMessage(org.ow2.chameleon.mail.Mail mail,
javax.mail.internet.MimeMessage msg)
throws javax.mail.MessagingException
javax.mail.MessagingExceptionprivate void sendMessageWithMockServer(org.ow2.chameleon.mail.Mail mail,
javax.mail.internet.MimeMessage msg)
throws javax.mail.MessagingException
mail - the mailmsg - the mime messagejavax.mail.MessagingException - if the message if malformed.public static javax.mail.internet.InternetAddress[] convert(java.util.List<java.lang.String> addresses)
throws javax.mail.internet.AddressException
InternetAddress.addresses - the addresses, must not be null, but can be empty.javax.mail.internet.AddressException - if one of the address from 'addresses' is invalid.Copyright © 2013-2015 Wisdom Framework. All Rights Reserved.