Klasse ServiceMail
java.lang.Object
de.dlr.proseo.notification.service.ServiceMail
The mail service to send emails using JavaMail. It provides methods to send plain text or MIME (HTML) emails.
- Autor:
- Ernst Melchinger
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibung(Package privat) NotificationConfiguration
The configuration of the notification service -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.springframework.mail.javamail.JavaMailSenderImpl
Creates and configures a JavaMailSenderImpl instance with the necessary properties, and reads the mail-related configuration from the NotificationConfiguration.void
sendMail
(String endpoint, String subject, org.springframework.http.MediaType mediaType, String messageCode, String message, String sender) Sends an email based on the provided parameters.void
Send an HTML email as a MIME message based on the provided parameters.void
Send a plain text email based on the provided parameters.
-
Felddetails
-
config
The configuration of the notification service
-
-
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 addresssubject
- The email subjectmediaType
- The media type to send the emailmessageCode
- The message codemessage
- The email bodysender
- The email sender- Löst aus:
IllegalArgumentException
- if an error occurs during mail preparationorg.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 addresssubject
- The email subjectmessageCode
- The message codemessage
- The email bodysender
- 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 addresssubject
- The email subjectmessageCode
- The message codemessage
- The email bodysender
- The email sender- Löst aus:
IllegalArgumentException
- if an error occurs during mail preparationorg.springframework.mail.MailException
- if an error occurs during mail sending
-