Class CmsHtmlMail

java.lang.Object
org.apache.commons.mail.Email
org.apache.commons.mail.MultiPartEmail
org.apache.commons.mail.HtmlEmail
org.opencms.mail.CmsHtmlMail
Direct Known Subclasses:
A_CmsNotification

public class CmsHtmlMail extends org.apache.commons.mail.HtmlEmail
This class is used to send an HTML formatted email with optional attachments.

A text message can also be set for HTML unaware email clients, such as text-based email clients.

It uses the Apache Commons Email API and extends the provided classes to conveniently generate emails using the OpenCms configuration.

Since:
6.0.0
  • Field Summary

    Fields inherited from class org.apache.commons.mail.HtmlEmail

    CID_LENGTH, html, inlineEmbeds, inlineImages, text

    Fields inherited from class org.apache.commons.mail.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
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor of a CmsHtmlMail.
    CmsHtmlMail(String mailHostId)
    Constructor of a CmsHtmlMail where the id of the mail host is explicitly chosen.
    Constructor of a CmsHtmlMail where the mail host is explicitly chosen.
  • Method Summary

    Methods inherited from class org.apache.commons.mail.HtmlEmail

    buildMimeMessage, embed, embed, embed, embed, embed, embed, setHtmlMsg, setMsg, setTextMsg

    Methods inherited from class org.apache.commons.mail.MultiPartEmail

    addPart, addPart, addPart, attach, attach, attach, attach, attach, attach, createBodyPart, createMimeMultipart, getContainer, getPrimaryBodyPart, getSubType, init, isBoolHasAttachments, isInitialized, setBoolHasAttachments, setInitialized, setSubType

    Methods inherited from class org.apache.commons.mail.Email

    addBcc, addBcc, addBcc, addBcc, addCc, addCc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addReplyTo, addTo, addTo, addTo, addTo, createMimeMessage, getBccAddresses, getBounceAddress, getCcAddresses, getFromAddress, getHeader, getHeaders, getHostName, getMailSession, getMimeMessage, getReplyToAddresses, getSentDate, getSmtpPort, getSocketConnectionTimeout, getSocketTimeout, getSslSmtpPort, getSubject, getToAddresses, isSendPartial, isSSL, isSSLCheckServerIdentity, isSSLOnConnect, isStartTLSEnabled, isStartTLSRequired, isTLS, send, sendMimeMessage, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setFrom, setFrom, setFrom, setHeaders, setHostName, setMailSession, setMailSessionFromJNDI, setPopBeforeSmtp, setReplyTo, setSendPartial, setSentDate, setSmtpPort, setSocketConnectionTimeout, setSocketTimeout, setSSL, setSSLCheckServerIdentity, setSSLOnConnect, setSslSmtpPort, setStartTLSEnabled, setStartTLSRequired, setSubject, setTLS, setTo, toInternetAddressArray, updateContentType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CmsHtmlMail

      public CmsHtmlMail()
      Default constructor of a CmsHtmlMail.

      The mail host name and the mail from address are set to the OpenCms default values of the configuration.

    • CmsHtmlMail

      public CmsHtmlMail(CmsMailHost mailHost)
      Constructor of a CmsHtmlMail where the mail host is explicitly chosen.

      The mail from address is set to the OpenCms default values of the configuration.

      Parameters:
      mailHost - the mail host to use (a host configured in OpenCms).
    • CmsHtmlMail

      public CmsHtmlMail(String mailHostId)
      Constructor of a CmsHtmlMail where the id of the mail host is explicitly chosen.

      If the mail host with the chosen id is not available, fall back to the default mail host.

      Parameters:
      mailHostId - the mail host id