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>
_attachments
private List<String>
_bcc
private List<String>
_cc
private boolean
_deliveryReceipt
private String
_host
private String
_htmlBody
private org.slf4j.Logger
_logger
private String
_password
private long
_port
private boolean
_readReceipt
private List<String>
_recipients
private String
_securityProtocol
private String
_sender
private boolean
_singleEmail
private String
_subject
private String
_textBody
private 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)
void
run()
void
sendMail()
-
-
-
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.MessagingException
IOException
-
_sendMail
private void _sendMail(javax.mail.internet.MimeMessage message, javax.mail.Transport tr) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
-