public class Smtp extends 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 String |
CONFAUTH |
private static String |
CONFHOST |
(package private) org.wisdom.api.configuration.ApplicationConfiguration |
configuration |
private static String |
CONFPORT |
protected Smtp.Connection |
connection |
private boolean |
debug
Enables / Disabled debugging.
|
static String |
DEFAULT_FROM |
protected String |
from
The mail address of the sender.
|
protected String |
host
The host.
|
private static org.slf4j.Logger |
LOGGER |
static String |
MOCK_SERVER_NAME |
protected String |
password
The password.
|
protected int |
port
The port.
|
private Properties |
properties
Configuration properties.
|
private static String |
SEPARATOR |
private javax.mail.Authenticator |
sslAuthentication
The authenticator used for SSL.
|
protected boolean |
useMock
True we should use the mock server.
|
protected String |
username
The username.
|
protected 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(List<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(String to,
String cc,
String subject,
String body)
Sends a mail.
|
void |
send(String to,
String cc,
String subject,
String body,
List<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 String MOCK_SERVER_NAME
public static final String DEFAULT_FROM
private static final String CONFHOST
private static final String CONFPORT
private static final String CONFAUTH
private static final String SEPARATOR
org.wisdom.api.configuration.ApplicationConfiguration configuration
private Properties properties
private boolean debug
protected String from
protected int port
protected String host
protected String username
protected String password
private javax.mail.Authenticator sslAuthentication
protected boolean useMock
protected Boolean useSmtps
protected Smtp.Connection connection
protected void configure()
private void manageConnectionType()
public void reconfigure()
public void send(String to, String cc, String subject, String body) throws Exception
send in interface org.ow2.chameleon.mail.MailSenderServiceto - tocc - ccsubject - subjectbody - bodyException - if the mail cannot be sent.MailSenderService.send(java.lang.String, java.lang.String,
java.lang.String, java.lang.String)public void send(String to, String cc, String subject, String body, List<File> attachments) throws Exception
send in interface org.ow2.chameleon.mail.MailSenderServiceto - tocc - ccsubject - subjectbody - bodyattachments - list of attachmentsException - 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(List<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–2014 Wisdom Framework. All rights reserved.