Package atessera.sensei.util
Class MailSender
java.lang.Object
atessera.sensei.util.MailSender
Sends reports to students by e-mail.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether SMTP is configured well enough to send mail.voidSends a report mail message.
-
Constructor Details
-
MailSender
Creates a mail sender.- Parameters:
config- global configuration, must not benull
-
-
Method Details
-
isAvailable
public boolean isAvailable()Checks whether SMTP is configured well enough to send mail.- Returns:
truewhen host and sender are set properly
-
send
public void send(String to, String subject, String text) throws jakarta.mail.MessagingException, UnsupportedEncodingException Sends a report mail message.The sender name is set to "Сенсей UNIX". Subject and body are encoded in UTF-8 with Base64 transfer encoding, so non-ASCII characters (such as Cyrillic) are handled correctly.
- Parameters:
to- recipient addresssubject- message subjecttext- plain text body- Throws:
jakarta.mail.MessagingException- when message construction or transport failsUnsupportedEncodingException- when UTF-8 encoding is not supported by the platform
-