Class MailSender

java.lang.Object
atessera.sensei.util.MailSender

public final class MailSender extends Object
Sends reports to students by e-mail.
  • Constructor Details

    • MailSender

      public MailSender(SenseiConfig config)
      Creates a mail sender.
      Parameters:
      config - global configuration, must not be null
  • Method Details

    • isAvailable

      public boolean isAvailable()
      Checks whether SMTP is configured well enough to send mail.
      Returns:
      true when 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 address
      subject - message subject
      text - plain text body
      Throws:
      jakarta.mail.MessagingException - when message construction or transport fails
      UnsupportedEncodingException - when UTF-8 encoding is not supported by the platform