public class MultiPartEmail extends Email
This class is used to send multi-part internet email like messages with attachments.
To create a multi-part email, call the default constructor and then you can call setMsg() to set the message and call the different attach() methods.
ATTACHMENTS, authenticator, bccList, bounceAddress, ccList, charset, content, CONTENT_TYPE, contentType, debug, EMAIL_BODY, EMAIL_SUBJECT, emailBody, FILE_SERVER, fromAddress, headers, hostName, ISO_8859_1, KOI8_R, MAIL_DEBUG, MAIL_HOST, MAIL_PORT, MAIL_SMTP_AUTH, MAIL_SMTP_FROM, MAIL_TRANSPORT_PROTOCOL, message, popBeforeSmtp, popHost, popPassword, popUsername, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, sentDate, SMTP, smtpPort, subject, TEXT_HTML, TEXT_PLAIN, toList, US_ASCII| Constructor and Description |
|---|
MultiPartEmail() |
| Modifier and Type | Method and Description |
|---|---|
Email |
addPart(javax.mail.internet.MimeMultipart multipart)
Add a new part to the email.
|
Email |
addPart(String content,
String contentType)
Add a new part to the email.
|
MultiPartEmail |
attach(DataSource ds,
String name,
String description)
Attach a file specified as a DataSource interface.
|
MultiPartEmail |
attach(DataSource ds,
String name,
String description,
String disposition)
Attach a file specified as a DataSource interface.
|
MultiPartEmail |
attach(EmailAttachment attachment)
Attach an EmailAttachement.
|
MultiPartEmail |
attach(URL url,
String name,
String description)
Attach a file located by its URL.
|
MultiPartEmail |
attach(URL url,
String name,
String description,
String disposition)
Attach a file located by its URL.
|
protected javax.mail.internet.MimeMultipart |
getContainer()
Gets the message container.
|
protected javax.mail.internet.MimeBodyPart |
getPrimaryBodyPart()
Gets first body part of the message.
|
String |
getSubType()
Get the MIME subtype of the email.
|
protected void |
init()
Initialize the multipart email.
|
boolean |
isBoolHasAttachments() |
void |
send()
Sends the mail message
|
void |
setBoolHasAttachments(boolean b) |
Email |
setMsg(String msg)
Set the message of the email.
|
void |
setSubType(String aSubType)
Set the MIME subtype of the email.
|
addBcc, addBcc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addTo, addTo, getMailSession, getSentDate, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setFrom, setFrom, setHeaders, setHostName, setMailSession, setPopBeforeSmtp, setSentDate, setSmtpPort, setSubject, setTo, toInternetAddressArraypublic void setSubType(String aSubType)
aSubType - MIME subtype of the emailpublic String getSubType()
public Email addPart(String content, String contentType) throws javax.mail.MessagingException
content - The content.contentType - The content type.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic Email addPart(javax.mail.internet.MimeMultipart multipart) throws javax.mail.MessagingException
multipart - The MimeMultipart.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionsprotected void init()
throws javax.mail.MessagingException
javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic Email setMsg(String msg) throws javax.mail.MessagingException
public void send()
throws javax.mail.MessagingException
public MultiPartEmail attach(EmailAttachment attachment) throws javax.mail.MessagingException
attachment - An EmailAttachment.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic MultiPartEmail attach(URL url, String name, String description) throws javax.mail.MessagingException
url - The URL of the file (may be any valid URL).name - The name field for the attachment.description - A description for the attachment.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic MultiPartEmail attach(URL url, String name, String description, String disposition) throws javax.mail.MessagingException
url - The URL of the file (may be any valid URL).name - The name field for the attachment.description - A description for the attachment.disposition - Either mixed or inline.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic MultiPartEmail attach(DataSource ds, String name, String description) throws javax.mail.MessagingException
ds - A DataSource interface for the file.name - The name field for the attachment.description - A description for the attachment.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic MultiPartEmail attach(DataSource ds, String name, String description, String disposition) throws javax.mail.MessagingException
ds - A DataSource interface for the file.name - The name field for the attachment.description - A description for the attachement.disposition - Either mixed or inline.javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionsprotected javax.mail.internet.MimeBodyPart getPrimaryBodyPart()
throws javax.mail.MessagingException
javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionsprotected javax.mail.internet.MimeMultipart getContainer()
throws javax.mail.MessagingException
javax.mail.MessagingException - see javax.mail.internet.MimeBodyPart
for defintionspublic boolean isBoolHasAttachments()
public void setBoolHasAttachments(boolean b)
b - boolHasAttachmentsCopyright © 2020 B3Partners B.V.. All rights reserved.