Package com.adaptris.mail
Class MailSenderImp
java.lang.Object
com.adaptris.mail.MailSenderImp
- All Implemented Interfaces:
MailSender
- Direct Known Subclasses:
SmtpClient
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachment(byte[] bytes, String filename, String type) Add an attachment to the email.voidaddAttachment(byte[] bytes, String filename, String type, String encoding) Add an attachment to the email.voidAdd an attachment to the email.voidaddBlindCarbonCopy(String address) Add a name to the BCC list.voidaddBlindCarbonCopy(javax.mail.internet.InternetAddress[] address) Add some names to the BCC list.voidaddCarbonCopy(String address) Add some names to the CC list.voidaddCarbonCopy(javax.mail.internet.InternetAddress[] address) Add some names to the CC list.voidaddMailHeader(String key, String value) Add a header to the mail header.voidaddSessionProperty(String key, String value) Add a property to the set of properties used by the Session.voidAdd some names to the TO list.voidaddTo(javax.mail.internet.InternetAddress[] address) Add some names to the TO list.protected voidBuild the content of the MimeMessage from the constituent parts.voidCreate a new message Must be called prior to setting recipient list, mail body etc.voidremoveMailHeader(String key) Remove a mail header.voidRemove a property from the set of properties used by the Session.voidsetEncoding(String enc) Set the encoding type to use for the message type.voidSet the sender.voidsetFrom(javax.mail.internet.InternetAddress from) Set the sender.voidsetMessage(byte[] bytes) Set the messagevoidsetMessage(byte[] bytes, String contentType) Set the message and content type Content type maybe an arbitary string such as application/edi-x12, although if an appropriateDataContentHandleris not installed, then the results can be undefined.voidsetSubject(String s) Set the subject of the email.voidStart session based on session properties This may be used to initialise the client prior to sending any mailMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.adaptris.mail.MailSender
send
-
Field Details
-
session
protected javax.mail.Session session -
message
protected javax.mail.internet.MimeMessage message
-
-
Constructor Details
-
MailSenderImp
protected MailSenderImp()
-
-
Method Details
-
addSessionProperty
Add a property to the set of properties used by the Session.- Specified by:
addSessionPropertyin interfaceMailSender- Parameters:
key- the keyvalue- the value.
-
removeSessionProperty
Remove a property from the set of properties used by the Session.- Specified by:
removeSessionPropertyin interfaceMailSender- Parameters:
key-
-
startSession
Description copied from interface:MailSenderStart session based on session properties This may be used to initialise the client prior to sending any mail- Specified by:
startSessionin interfaceMailSender- Throws:
MailException
-
newMessage
Description copied from interface:MailSenderCreate a new message Must be called prior to setting recipient list, mail body etc.- Specified by:
newMessagein interfaceMailSender- Throws:
MailException
-
addMailHeader
Description copied from interface:MailSenderAdd a header to the mail header.- Specified by:
addMailHeaderin interfaceMailSender- Parameters:
key- the keyvalue- the value.- Throws:
MailException
-
removeMailHeader
Remove a mail header.- Specified by:
removeMailHeaderin interfaceMailSender- Parameters:
key-- Throws:
MailException
-
addTo
Description copied from interface:MailSenderAdd some names to the TO list.- Specified by:
addToin interfaceMailSender- Parameters:
address- an array of InternetAddress[] representing email addresses- Throws:
MailException- if the addresses could not be parsed.
-
addTo
Description copied from interface:MailSenderAdd some names to the TO list.- Specified by:
addToin interfaceMailSender- Parameters:
address- the email address name@company.com- Throws:
MailException- if the addresses could not be parsed.
-
addCarbonCopy
Description copied from interface:MailSenderAdd some names to the CC list.- Specified by:
addCarbonCopyin interfaceMailSender- Parameters:
address- an array of InternetAddress[] representing email addresses- Throws:
MailException- if the addresses could not be parsed.
-
addCarbonCopy
Description copied from interface:MailSenderAdd some names to the CC list.- Specified by:
addCarbonCopyin interfaceMailSender- Parameters:
address- the email address name@company.com- Throws:
MailException- if the addresses could not be parsed.
-
addBlindCarbonCopy
Description copied from interface:MailSenderAdd some names to the BCC list.- Specified by:
addBlindCarbonCopyin interfaceMailSender- Parameters:
address- an array of InternetAddress[] representing email addresses- Throws:
MailException- if the addresses could not be parsed.
-
addBlindCarbonCopy
Description copied from interface:MailSenderAdd a name to the BCC list.- Specified by:
addBlindCarbonCopyin interfaceMailSender- Parameters:
address- email address name@company.com- Throws:
MailException- if the addresses could not be parsed.
-
setFrom
Description copied from interface:MailSenderSet the sender.- Specified by:
setFromin interfaceMailSender- Parameters:
from- email address name@company.com- Throws:
MailException- if the addresses could not be parsed.
-
setFrom
Description copied from interface:MailSenderSet the sender.- Specified by:
setFromin interfaceMailSender- Parameters:
from- InternetAddress container for name@company.com- Throws:
MailException- if the addresses could not be parsed.
-
setSubject
Description copied from interface:MailSenderSet the subject of the email.- Specified by:
setSubjectin interfaceMailSender- Parameters:
s- the subject.- Throws:
MailException
-
addAttachment
public void addAttachment(byte[] bytes, String filename, String type, String encoding) throws MailException Description copied from interface:MailSenderAdd an attachment to the email.- Specified by:
addAttachmentin interfaceMailSender- Parameters:
bytes- the attachment;filename- the filename to use for the attachment.type- the content type to associate with this attachmentencoding- of the mime body part for this attachment- Throws:
MailException
-
addAttachment
Description copied from interface:MailSenderAdd an attachment to the email.- Specified by:
addAttachmentin interfaceMailSender- Parameters:
bytes- the attachment;filename- the filename to use for the attachment.type- the content type to associate with this attachment- Throws:
MailException
-
addAttachment
Description copied from interface:MailSenderAdd an attachment to the email.- Specified by:
addAttachmentin interfaceMailSender- Parameters:
a- object;- Throws:
MailException
-
setMessage
Description copied from interface:MailSenderSet the message- Specified by:
setMessagein interfaceMailSender- Parameters:
bytes- the message;- Throws:
MailException
-
setMessage
Description copied from interface:MailSenderSet the message and content type Content type maybe an arbitary string such as application/edi-x12, although if an appropriateDataContentHandleris not installed, then the results can be undefined.- Specified by:
setMessagein interfaceMailSender- Parameters:
bytes- the messagecontentType- the content type.- Throws:
MailException- See Also:
-
DataContentHandler
-
setEncoding
Description copied from interface:MailSenderSet the encoding type to use for the message type.Valid types of encoding are those defined in RFC2045. They include "base64", "quoted-printable", "7bit", "8bit" and "binary". In addition, "uuencode" is also supported.
- Specified by:
setEncodingin interfaceMailSender- Parameters:
enc- the encoding type to use.
-
buildContent
Build the content of the MimeMessage from the constituent parts.- Throws:
MailException
-