Package ome.services.mail
Class MailUtil
- java.lang.Object
-
- ome.services.mail.MailUtil
-
public class MailUtil extends java.lang.Object
Methods for dealing with the preparation of JavaMail MIME messages. The corresponding send methods of JavaMailSender will take care of the actual creation of a MimeMessage instance. Used primarily by asynchronous Ice services:omero.cmd.mail.SendEmailRequestI
.- Since:
- 5.1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.mail.javamail.JavaMailSender
mailSender
protected java.lang.String
sender
-
Constructor Summary
Constructors Constructor Description MailUtil(java.lang.String sender, org.springframework.mail.javamail.JavaMailSender mailSender)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getSender()
Helper method that returns value ofomero.mail.from
.void
sendEmail(java.lang.String to, java.lang.String topic, java.lang.String body, boolean html, java.util.List<java.lang.String> ccrecipients, java.util.List<java.lang.String> bccrecipients)
Overloaded method which takes typical email fields as arguments, to prepare and populate the given new MimeMessage instance and send.void
sendEmail(java.lang.String from, java.lang.String to, java.lang.String topic, java.lang.String body, boolean html, java.util.List<java.lang.String> ccrecipients, java.util.List<java.lang.String> bccrecipients)
Main method which takes typical email fields as arguments, to prepare and populate the given new MimeMessage instance and send.boolean
validateEmail(java.lang.String email)
Helper Validate that this address conforms to the syntax rules of RFC 822.
-
-
-
Method Detail
-
getSender
public java.lang.String getSender()
Helper method that returns value ofomero.mail.from
.
-
sendEmail
public void sendEmail(java.lang.String from, java.lang.String to, java.lang.String topic, java.lang.String body, boolean html, java.util.List<java.lang.String> ccrecipients, java.util.List<java.lang.String> bccrecipients)
Main method which takes typical email fields as arguments, to prepare and populate the given new MimeMessage instance and send.- Parameters:
from
- email address message is sent fromto
- email address message is sent totopic
- topic of the messagebody
- body of the messagehtml
- flag determines the content type to apply.ccrecipients
- list of email addresses message is sent as copy tobccrecipients
- list of email addresses message is sent as blind copy to
-
sendEmail
public void sendEmail(java.lang.String to, java.lang.String topic, java.lang.String body, boolean html, java.util.List<java.lang.String> ccrecipients, java.util.List<java.lang.String> bccrecipients)
Overloaded method which takes typical email fields as arguments, to prepare and populate the given new MimeMessage instance and send. Sender of the email is loaded from omero.mail.from- Parameters:
to
- email address message is sent totopic
- topic of the messagebody
- body of the messagehtml
- flag determines the content type to apply.ccrecipients
- list of email addresses message is sent as copy tobccrecipients
- list of email addresses message is sent as blind copy to
-
validateEmail
public boolean validateEmail(java.lang.String email)
Helper Validate that this address conforms to the syntax rules of RFC 822.- Parameters:
email
- email address
-
-