类 HtmlEmail
Description: An HTML multipart email.
Title:首亨软件 - TSS/CRM等
- 从以下版本开始:
- Aug 13, 2012
-
字段概要
字段修饰符和类型字段说明static final intDefinition of the length of generated CID'sprotected StringHtml part of the messageprotected MapEmbedded images Map<String, InlineImage> where the key is the user-defined image name.protected ListAs of commons-email 1.1, no longer used.protected StringText part of the message.从类继承的字段 com.sh.mail.core.Email
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_CONNECTIONTIMEOUT, MAIL_SMTP_FROM, MAIL_SMTP_PASSWORD, MAIL_SMTP_SOCKET_FACTORY_CLASS, MAIL_SMTP_SOCKET_FACTORY_FALLBACK, MAIL_SMTP_SOCKET_FACTORY_PORT, MAIL_SMTP_TIMEOUT, MAIL_SMTP_USER, MAIL_TRANSPORT_PROTOCOL, MAIL_TRANSPORT_TLS, message, popBeforeSmtp, popHost, popPassword, popUsername, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, sentDate, SMTP, smtpPort, socketConnectionTimeout, socketTimeout, ssl, sslSmtpPort, subject, TEXT_HTML, TEXT_PLAIN, tls, toList, US_ASCII -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidDoes the work of actually building the email.Embeds the specifiedDataSourcein the HTML using a randomly generated Content-ID.Embeds the specifiedDataSourcein the HTML using the specified Content-ID.Embeds a file in the HTML.Embeds a file in the HTML.Attempts to parse the specifiedStringas a URL that will then be embedded in the message.Embeds an URL in the HTML.setHtmlMsg(String aHtml) Set the HTML content.Set the message.setTextMsg(String aText) Set the text content.从类继承的方法 com.sh.mail.core.MultiPartEmail
addPart, addPart, addPart, attach, attach, attach, attach, attach, createBodyPart, createMimeMultipart, getContainer, getPrimaryBodyPart, getSubType, init, isBoolHasAttachments, isInitialized, setBoolHasAttachments, setInitialized, setSubType从类继承的方法 com.sh.mail.core.Email
addBcc, addBcc, addBcc, addCc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addReplyTo, addTo, addTo, addTo, createMimeMessage, getBccAddresses, getCcAddresses, getFromAddress, getHostName, getMailSession, getMimeMessage, getReplyToAddresses, getSentDate, getSmtpPort, getSocketConnectionTimeout, getSocketTimeout, getSslSmtpPort, getSubject, getToAddresses, isSSL, isTLS, resetToAddress, send, sendMimeMessage, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setFrom, setFrom, setFrom, setHeaders, setHostName, setMailSession, setMailSessionFromJNDI, setPopBeforeSmtp, setReplyTo, setSentDate, setSmtpPort, setSocketConnectionTimeout, setSocketTimeout, setSSL, setSslSmtpPort, setSubject, setTLS, setTo, toInternetAddressArray, updateContentType
-
字段详细资料
-
CID_LENGTH
public static final int CID_LENGTHDefinition of the length of generated CID's- 另请参阅:
-
text
Text part of the message. This will be used as alternative text if the email client does not support HTML messages. -
html
Html part of the message -
inlineImages
As of commons-email 1.1, no longer used. Inline embedded objects are now stored ininlineEmbeds. -
inlineEmbeds
Embedded images Map<String, InlineImage> where the key is the user-defined image name.
-
-
构造器详细资料
-
HtmlEmail
public HtmlEmail()
-
-
方法详细资料
-
setTextMsg
Set the text content.- 参数:
aText- A String.- 返回:
- An HtmlEmail.
- 抛出:
EmailException- see javax.mail.internet.MimeBodyPart for definitions- 从以下版本开始:
- 1.0
-
setHtmlMsg
Set the HTML content.- 参数:
aHtml- A String.- 返回:
- An HtmlEmail.
- 抛出:
EmailException- see javax.mail.internet.MimeBodyPart for definitions- 从以下版本开始:
- 1.0
-
setMsg
Set the message.This method overrides
MultiPartEmail.setMsg(String)in order to send an HTML message instead of a plain text message in the mail body. The message is formatted in HTML for the HTML part of the message; it is left as is in the alternate text part.- 覆盖:
setMsg在类中MultiPartEmail- 参数:
msg- the message text to use- 返回:
- this
HtmlEmail - 抛出:
EmailException- if msg is null or empty; see javax.mail.internet.MimeBodyPart for definitions- 从以下版本开始:
- 1.0
-
embed
Attempts to parse the specifiedStringas a URL that will then be embedded in the message.- 参数:
urlString- String representation of the URL.name- The name that will be set in the filename header field.- 返回:
- A String with the Content-ID of the URL.
- 抛出:
EmailException- when URL supplied is invalid or if is null or empty; also seejavax.mail.internet.MimeBodyPartfor definitions- 从以下版本开始:
- 1.1
- 另请参阅:
-
embed
Embeds an URL in the HTML.This method embeds a file located by an URL into the mail body. It allows, for instance, to add inline images to the email. Inline files may be referenced with a
cid:xxxxxxURL, where xxxxxx is the Content-ID returned by the embed function. It is an error to bind the same name to more than one URL; if the same URL is embedded multiple times, the same Content-ID is guaranteed to be returned.While functionally the same as passing
URLDataSourcetoembed(DataSource, String, String), this method attempts to validate the URL before embedding it in the message and will throwEmailExceptionif the validation fails. In this case, theHtmlEmailobject will not be changed.NOTE: Clients should take care to ensure that different URLs are bound to different names. This implementation tries to detect this and throw
EmailException. However, it is not guaranteed to catch all cases, especially when the URL refers to a remote HTTP host that may be part of a virtual host cluster.- 参数:
url- The URL of the file.name- The name that will be set in the filename header field.- 返回:
- A String with the Content-ID of the file.
- 抛出:
EmailException- when URL supplied is invalid or if is null or empty; also seejavax.mail.internet.MimeBodyPartfor definitions- 从以下版本开始:
- 1.0
-
embed
Embeds a file in the HTML. This implementation delegates toembed(File, String).- 参数:
file- TheFileobject to embed- 返回:
- A String with the Content-ID of the file.
- 抛出:
EmailException- when the suppliedFilecannot be used; also seejavax.mail.internet.MimeBodyPartfor definitions- 从以下版本开始:
- 1.1
- 另请参阅:
-
embed
Embeds a file in the HTML.This method embeds a file located by an URL into the mail body. It allows, for instance, to add inline images to the email. Inline files may be referenced with a
cid:xxxxxxURL, where xxxxxx is the Content-ID returned by the embed function. Files are bound to their names, which is the value returned byFile.getName(). If the same file is embedded multiple times, the same CID is guaranteed to be returned.While functionally the same as passing
FileDataSourcetoembed(DataSource, String, String), this method attempts to validate the file before embedding it in the message and will throwEmailExceptionif the validation fails. In this case, theHtmlEmailobject will not be changed.- 参数:
file- TheFileto embedcid- the Content-ID to use for the embeddedFile- 返回:
- A String with the Content-ID of the file.
- 抛出:
EmailException- when the suppliedFilecannot be used or if the file has already been embedded; also seejavax.mail.internet.MimeBodyPartfor definitions- 从以下版本开始:
- 1.1
-
embed
Embeds the specifiedDataSourcein the HTML using a randomly generated Content-ID. Returns the generated Content-ID string.- 参数:
dataSource- theDataSourceto embedname- the name that will be set in the filename header field- 返回:
- the generated Content-ID for this
DataSource - 抛出:
EmailException- if the embedding fails or ifnameis null or empty- 从以下版本开始:
- 1.1
- 另请参阅:
-
embed
public String embed(jakarta.activation.DataSource dataSource, String name, String cid) throws EmailException Embeds the specifiedDataSourcein the HTML using the specified Content-ID. Returns the specified Content-ID string.- 参数:
dataSource- theDataSourceto embedname- the name that will be set in the filename header fieldcid- the Content-ID to use for thisDataSource- 返回:
- the supplied Content-ID for this
DataSource - 抛出:
EmailException- if the embedding fails or ifnameis null or empty- 从以下版本开始:
- 1.1
-
buildMimeMessage
Does the work of actually building the email.- 覆盖:
buildMimeMessage在类中MultiPartEmail- 抛出:
EmailException- if there was an error.- 从以下版本开始:
- 1.0
-