Package ch.autumo.beetroot.mailing
Class AbstractMailer
java.lang.Object
ch.autumo.beetroot.mailing.AbstractMailer
- All Implemented Interfaces:
Mailer
- Direct Known Subclasses:
JakartaMailer,JavaxMailer
Abstract mailer class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanMail authentication?static final intdefault SMTP port.protected StringMail from (email).protected StringSMTP Host.protected String[]Mail formats.protected StringMail user password.protected intSMTP Port.protected StringSMTP Port string.protected booleanPasswords encoded in mail configuration section ('cfg/beetroot.cfg')?protected booleanSSL enabled?protected booleanTLS enabled?protected StringMail user (email).Fields inherited from interface ch.autumo.beetroot.mailing.Mailer
EMAIL_PATTERN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertiesInitialize mail configuration; some are store in the returned properties and some attributes are initialized.protected StringloadTemplate(String templateName, BeetRootHTTPSession session, String extension) Load mail template.protected StringloadTemplateWithVariables(String templateName, BeetRootHTTPSession session, Map<String, String> variables, String format) Load language translated templates with variables replaced.abstract voidmail(String[] to, String subject, Map<String, String> variables, String templateName, BeetRootHTTPSession session) protected StringreplaceAllLanguageVariables(String template, BeetRootHTTPSession session, String extension) Replace language variables in loaded mail template.protected StringReplace general variables in loaded mail template.
-
Field Details
-
DEFAULT_SMTP_PORT
public static final int DEFAULT_SMTP_PORTdefault SMTP port.- See Also:
-
mailformats
Mail formats. -
auth
protected boolean authMail authentication? -
tlsEnable
protected boolean tlsEnableTLS enabled? -
sslEnable
protected boolean sslEnableSSL enabled? -
port
protected int portSMTP Port. -
portStr
SMTP Port string. -
host
SMTP Host. -
pwEncoded
protected boolean pwEncodedPasswords encoded in mail configuration section ('cfg/beetroot.cfg')? -
user
Mail user (email). -
password
Mail user password. -
from
Mail from (email).
-
-
Constructor Details
-
AbstractMailer
public AbstractMailer()
-
-
Method Details
-
initialize
Initialize mail configuration; some are store in the returned properties and some attributes are initialized.- Returns:
- mail configuration
- Throws:
Exception- if configuration loading fails
-
loadTemplateWithVariables
protected String loadTemplateWithVariables(String templateName, BeetRootHTTPSession session, Map<String, String> variables, String format) throws ExceptionLoad language translated templates with variables replaced.- Parameters:
templateName- template namesession- HTTPS sessionvariables- variablesformat- mail format- Returns:
- replaced template
- Throws:
Exception
-
loadTemplate
protected String loadTemplate(String templateName, BeetRootHTTPSession session, String extension) throws Exception Load mail template.- Parameters:
templateName- template namesession- HTTP session or null (default language is used)extension- template extension (txt or html)- Returns:
- loaded template as string
- Throws:
Exception- if an error occurs
-
replaceAllLanguageVariables
protected String replaceAllLanguageVariables(String template, BeetRootHTTPSession session, String extension) Replace language variables in loaded mail template.- Parameters:
template- loaded te,platesession- HTTP session or null (default language is used)extension- template extension (txt or html)- Returns:
- template with replaced language variables
-
replaceAllVariables
protected String replaceAllVariables(String template, Map<String, String> variables, String extension) Replace general variables in loaded mail template.- Parameters:
template- loaded templatevariables- variables to replaceextension- template extension (txt or html)- Returns:
- replaced templates
-
mail
-