public final class EmailSender
extends java.lang.Object
configure method must have been called at least once globally before email
can be sent.| Constructor and Description |
|---|
EmailSender() |
| Modifier and Type | Method and Description |
|---|---|
static void |
configure(java.lang.String smtpHost,
int smtpPort,
boolean useTls,
java.lang.String account,
java.lang.String password,
java.lang.String name)
Configure the global SMTP properties for sending mail.
|
static void |
send(Email email,
java.lang.String to)
Send a HTML email using SMTP to a specified email address.
|
public static void configure(java.lang.String smtpHost,
int smtpPort,
boolean useTls,
java.lang.String account,
java.lang.String password,
java.lang.String name)
smtpHost - the host of the SMTP serversmtpPort - the port of the SMTP serveruseTls - should TLS be used when connecting to the SMTP server?account - the authorization email addresspassword - the password to use during authorizationname - the name the email will be sent withpublic static void send(Email email, java.lang.String to) throws javax.mail.MessagingException, java.lang.IllegalStateException
email - the emailto - the address to send the email tojava.lang.IllegalStateException - if the EmailSender has not be configured globallyjavax.mail.MessagingException - if something goes wrong when connecting to the SMTP server or sending the mailCopyright © 2021. All rights reserved.