public class DefaultTransport extends Object implements MailTransport
Modifier and Type | Field and Description |
---|---|
protected static String |
ALTERNATIVE |
protected static String |
CONTENT_TRANSFER_ENCODING |
protected boolean |
debug |
protected boolean |
disableSend |
static String |
HOST |
protected static String |
MIXED |
protected Properties |
p |
static String |
PORT |
protected javax.mail.Session |
session |
protected static String |
TEXT_HTML |
protected static String |
UTF_8 |
Modifier | Constructor and Description |
---|---|
protected |
DefaultTransport() |
|
DefaultTransport(Properties props) |
|
DefaultTransport(Properties props,
String user,
String password) |
|
DefaultTransport(javax.mail.Session session) |
|
DefaultTransport(String host,
int port) |
Modifier and Type | Method and Description |
---|---|
protected javax.mail.Message |
buildMessage(Mail mail) |
protected javax.mail.Message |
buildMessage(javax.mail.Message mimeMessage,
Mail mail) |
Mail |
createMail()
Creates and returns a new
Mail . |
void |
disableSend() |
String |
getMailAsString(Mail mail)
|
boolean |
isDebug() |
boolean |
isDisableSend()
Checks whether this
MailTransport is disabled. |
void |
send(Mail mail)
Send the given
Mail . |
protected void |
send(Mail mail,
Collection<String> invalidAdresses) |
void |
setDebug(boolean debug) |
void |
setDisableSend(boolean disableSend)
Enable/disable sending for this
MailTransport . |
javax.mail.Address |
toAddress(Address address) |
protected static final String TEXT_HTML
protected static final String CONTENT_TRANSFER_ENCODING
protected static final String UTF_8
protected static final String MIXED
protected static final String ALTERNATIVE
public static final String HOST
public static final String PORT
protected javax.mail.Session session
protected Properties p
protected boolean disableSend
protected boolean debug
protected DefaultTransport()
public DefaultTransport(javax.mail.Session session)
public DefaultTransport(String host, int port)
public DefaultTransport(Properties props)
public DefaultTransport(Properties props, String user, String password)
public Mail createMail()
MailTransport
Mail
.createMail
in interface MailTransport
Mail
public void send(Mail mail) throws MailException
MailTransport
Mail
.send
in interface MailTransport
mail
- the Mail
to sendMailException
- if an error occurs while sending the Mail
public String getMailAsString(Mail mail)
MailTransport
Mail
.Mail
may contain sensitive informations like passwords!getMailAsString
in interface MailTransport
mail
- the Mail
to get the string-representation forString
representation the Mail
protected void send(Mail mail, Collection<String> invalidAdresses) throws MailException
MailException
protected javax.mail.Message buildMessage(Mail mail) throws MailException
MailException
protected javax.mail.Message buildMessage(javax.mail.Message mimeMessage, Mail mail) throws MailException
MailException
public void disableSend()
public boolean isDisableSend()
MailTransport
MailTransport
is disabled.isDisableSend
in interface MailTransport
true
if this MailTransport
is disabled, false
otherwise.public void setDisableSend(boolean disableSend)
MailTransport
MailTransport
. If set to true
, Mail
s will be logged
instead of being send.setDisableSend
in interface MailTransport
public boolean isDebug()
public void setDebug(boolean debug)
public javax.mail.Address toAddress(Address address) throws UnsupportedEncodingException
UnsupportedEncodingException
Copyright © 2011–2020 aiticon GmbH. All rights reserved.