MailSender¶
-
public class
MailSender
extends MailConnector¶ MailSender is a mail connector for making connections to outgoing mail servers.
Author: Hugo Y. K. Lam
Methods¶
createMessage¶
-
public MimeMessage
createMessage
()¶ Creates a MIME message from the underlying mail properties.
Returns: a new MIME message.
createMessage¶
-
public MimeMessage
createMessage
(Session session)¶ Creates a MIME message from the given mail session.
Parameters: - session – the mail session.
Returns: a new MIME message.
createMessage¶
-
public MimeMessage
createMessage
(String from, String to, String cc, String subject)¶ Creates a simple MIME message with some basic headers.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
Throws: - ConnectionException – if error occurred in constructing the mail message.
Returns: a new MIME message.
createMessage¶
-
public MimeMessage
createMessage
(String from, String to, String cc, String subject, Session session)¶ Creates a simple MIME message with some basic headers.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- session – the mail session.
Throws: - ConnectionException – if error occurred in constructing the mail message.
Returns: a new MIME message.
send¶
-
public void
send
(String from, String to, String cc, String subject, String body)¶ Sends a simple mail message.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- body – the message content.
Throws: - ConnectionException – if unable to construct the mail message or to send out the message.
send¶
-
public void
send
(Message msg)¶ Sends a mail message.
Parameters: - msg – the mail message to be sent.
Throws: - ConnectionException – if unable to send the mail message