Klasse ServiceMail

java.lang.Object
de.dlr.proseo.notification.service.ServiceMail

@Service public class ServiceMail extends Object
The mail service to send emails using JavaMail. It provides methods to send plain text or MIME (HTML) emails.
Autor:
Ernst Melchinger
  • Felddetails

  • Konstruktordetails

    • ServiceMail

      public ServiceMail()
  • Methodendetails

    • getMailSender

      public org.springframework.mail.javamail.JavaMailSenderImpl getMailSender()
      Creates and configures a JavaMailSenderImpl instance with the necessary properties, and reads the mail-related configuration from the NotificationConfiguration.
      Gibt zurück:
      The JavaMailSenderImpl instance
    • sendMail

      public void sendMail(String endpoint, String subject, org.springframework.http.MediaType mediaType, String messageCode, String message, String sender) throws IllegalArgumentException, org.springframework.mail.MailException
      Sends an email based on the provided parameters. The email can be sent as plain text or MIME (HTML) format.
      Parameter:
      endpoint - The email address
      subject - The email subject
      mediaType - The media type to send the email
      messageCode - The message code
      message - The email body
      sender - The email sender
      Löst aus:
      IllegalArgumentException - if an error occurs during mail preparation
      org.springframework.mail.MailException - if an error occurs during mail sending
    • sendSimpleMessage

      public void sendSimpleMessage(String to, String subject, String messageCode, String message, String sender) throws org.springframework.mail.MailException
      Send a plain text email based on the provided parameters.
      Parameter:
      to - The email address
      subject - The email subject
      messageCode - The message code
      message - The email body
      sender - The email sender
      Löst aus:
      org.springframework.mail.MailException - If an error occurs during mail sending
    • sendMimeMessage

      public void sendMimeMessage(String to, String subject, String messageCode, String message, String sender) throws IllegalArgumentException, org.springframework.mail.MailException
      Send an HTML email as a MIME message based on the provided parameters.
      Parameter:
      to - The email address
      subject - The email subject
      messageCode - The message code
      message - The email body
      sender - The email sender
      Löst aus:
      IllegalArgumentException - if an error occurs during mail preparation
      org.springframework.mail.MailException - if an error occurs during mail sending