Package org.ametys.core.util.mail
Class SendMailHelper.MailSender
- java.lang.Object
-
- org.ametys.core.util.mail.SendMailHelper.MailSender
-
- All Implemented Interfaces:
Runnable
- Enclosing class:
- SendMailHelper
private static class SendMailHelper.MailSender extends Object implements Runnable
-
-
Field Summary
Fields Modifier and Type Field Description private Collection<File>_attachmentsprivate List<String>_bccprivate List<String>_ccprivate boolean_deliveryReceiptprivate String_hostprivate String_htmlBodyprivate org.slf4j.Logger_loggerprivate String_passwordprivate long_portprivate boolean_readReceiptprivate List<String>_recipientsprivate String_securityProtocolprivate String_senderprivate boolean_singleEmailprivate String_subjectprivate String_textBodyprivate String_user
-
Constructor Summary
Constructors Constructor Description MailSender(org.slf4j.Logger logger, String subject, String htmlBody, String textBody, Collection<File> attachments, List<String> recipients, String sender, List<String> cc, List<String> bcc, boolean deliveryReceipt, boolean readReceipt, String host, long port, String securityProtocol, String user, String password, boolean singleEmail)Initialize the mail sender with email parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_sendMail(javax.mail.internet.MimeMessage message, javax.mail.Transport tr)voidrun()voidsendMail()
-
-
-
Field Detail
-
_attachments
private Collection<File> _attachments
-
_recipients
private List<String> _recipients
-
_deliveryReceipt
private boolean _deliveryReceipt
-
_readReceipt
private boolean _readReceipt
-
_port
private long _port
-
_securityProtocol
private String _securityProtocol
-
_singleEmail
private boolean _singleEmail
-
_logger
private org.slf4j.Logger _logger
-
-
Constructor Detail
-
MailSender
public MailSender(org.slf4j.Logger logger, String subject, String htmlBody, String textBody, Collection<File> attachments, List<String> recipients, String sender, List<String> cc, List<String> bcc, boolean deliveryReceipt, boolean readReceipt, String host, long port, String securityProtocol, String user, String password, boolean singleEmail)
Initialize the mail sender with email parameters- Parameters:
logger- The loggersubject- The mail subjecthtmlBody- The HTML mail body. Can be null.textBody- The text mail body. Can be null.attachments- the file attachments. Can be null.recipients- The recipients addressessender- The sender address. Can be null when called by MailChecker.cc- Carbon copy address list. Can be null.bcc- Blind carbon copy address list. Can be null.deliveryReceipt- true to request that the receiving mail server send a notification when the mail is received.readReceipt- true to request that the receiving mail client send a notification when the person opens the mail.host- The server mail host. Can be null when called by MailChecker.securityProtocol- the security protocol to use when transporting the emailport- The server portuser- The user namepassword- The user passwordsingleEmail- true if just one email is sent with all recipients. Otherwise, an email will be sent for each recipients.
-
-
Method Detail
-
sendMail
public void sendMail() throws javax.mail.MessagingException, IOException
- Throws:
javax.mail.MessagingExceptionIOException
-
_sendMail
private void _sendMail(javax.mail.internet.MimeMessage message, javax.mail.Transport tr) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
-