| java.lang.Object jwebtk.mail.EmailSender
EmailSender | public class EmailSender (Code) | | Handles sending emails via any SMTP server. EmailSender can handle plain
text and/or HTML messages, any number of: send tos, cc tos, bcc tos, reply tos,
and any number of attachments.
|
Inner Class :class MyAuthenticator extends Authenticator | |
Inner Class :class BodyObject | |
Method Summary | |
public void | addAttachment(String name, String filename, String description, boolean inline) Add an attachment to the email. | public void | addAttachment(String name, File file, String description, boolean inline) Add an attachment to the email. | public void | addAttachment(String name, URL url, String description, boolean inline) Add an attachment to the email. | public void | addBCCTo(String address) Add a BCC to address to the email. | public void | addBCCTo(String address, String name) Add a BCC to address to the email. | public void | addCCTo(String address) Add a CC to address to the email. | public void | addCCTo(String address, String name) Add a CC to address to the email. | public void | addHtml(String htmlMessage) Add HTML to the email. | public void | addReplyTo(String address) Add a replay to address to the email. | public void | addReplyTo(String address, String name) Add a replay to address to the email. | public void | addSendTo(String address) Add a send to address to the email. | public void | addSendTo(String address, String name) Add a send to address to the email. | public void | addText(String textMessage) Add a text message to the email. | MimeMultipart | buildMultiPartContent() | public Message | getJavaMailMessage() Return the actual JavaMail Message object. | public Session | getJavaMailSession() Return the actual JavaMail Session object. | public static void | main(String[] args) | public void | sendEmail() Send the email. | public static void | sendEmail(String host, InternetAddress addressFrom, InternetAddress addressTo, String subject, String message) Convenience method for sending simple emails. | public static void | sendEmail(String host, String userId, String password, InternetAddress addressFrom, InternetAddress addressTo, String subject, String message) Convenience method for sending simple emails. | public static void | sendEmail(InternetAddress addressFrom, InternetAddress addressTo, String subject, String message) Convenience method for sending simple emails. | public static void | sendEmail(String host, String addressFrom, String fromName, String addressTo, String toName, String subject, String message) Convenience method for sending simple emails. | public static void | sendEmail(String host, String userId, String password, String addressFrom, String fromName, String addressTo, String toName, String subject, String message) Convenience method for sending simple emails. | public static void | sendEmail(String addressFrom, String fromName, String addressTo, String toName, String subject, String message) Convenience method for sending simple emails. | public void | setDebug(boolean debug) Turns debugging on or off. | public void | setSentFrom(String address) Set the from address for the email. | public void | setSentFrom(String address, String name) Set the from address for the email. | public void | setSubject(String subject) Set the subject of the email message. |
message | SMTPMessage message(Code) | | |
send_tosend_ccsend_bccreply_tobody_objects | Vector send_tosend_ccsend_bccreply_tobody_objects(Code) | | |
smtp_hostuser_idpassword | String smtp_hostuser_idpassword(Code) | | |
EmailSender | public EmailSender(String smtpHost)(Code) | | Create instance of EmailSender.
Parameters: smtpHost - the domain or IP address of the SMTP host |
EmailSender | public EmailSender(String smtpHost, String userId, String password)(Code) | | Create instance of EmailSender.
Parameters: smtpHost - the domain or IP address of the SMTP host Parameters: userId - Authenticate with userId Parameters: password - Authenticate with password |
EmailSender | public EmailSender(String smtpHost, int port, String userId, String password)(Code) | | Create instance of EmailSender.
Parameters: smtpHost - the domain or IP address of the SMTP host Parameters: port - the port the SMTP host is running on Parameters: userId - Authenticate with userId Parameters: password - Authenticate with password |
addAttachment | public void addAttachment(String name, String filename, String description, boolean inline)(Code) | | Add an attachment to the email.
Parameters: name - attachments name (simple filename, example: file.txt) Parameters: filename - the attachment file path Parameters: description - a description for the attachment Parameters: inline - is the attachment inline |
addAttachment | public void addAttachment(String name, File file, String description, boolean inline)(Code) | | Add an attachment to the email.
Parameters: name - attachments name (simple filename, example: file.txt) Parameters: file - the attachment file path Parameters: description - a description for the attachment Parameters: inline - is the attachment inline |
addAttachment | public void addAttachment(String name, URL url, String description, boolean inline)(Code) | | Add an attachment to the email.
Parameters: name - attachments name (simple filename, example: file.txt) Parameters: url - URL to the attachment Parameters: description - a description for the attachment Parameters: inline - is the attachment inline |
addBCCTo | public void addBCCTo(String address) throws EmailSenderException(Code) | | Add a BCC to address to the email.
Parameters: address - address to BCC the email to |
addBCCTo | public void addBCCTo(String address, String name) throws EmailSenderException(Code) | | Add a BCC to address to the email.
Parameters: address - address to BCC the email to Parameters: name - associate address with name |
addCCTo | public void addCCTo(String address, String name) throws EmailSenderException(Code) | | Add a CC to address to the email.
Parameters: address - address to CC the email to Parameters: name - associate address with name |
addHtml | public void addHtml(String htmlMessage)(Code) | | Add HTML to the email.
Parameters: htmlMessage - the HTML message |
addReplyTo | public void addReplyTo(String address) throws EmailSenderException(Code) | | Add a replay to address to the email.
Parameters: address - address to reply to |
addReplyTo | public void addReplyTo(String address, String name) throws EmailSenderException(Code) | | Add a replay to address to the email.
Parameters: address - address to reply to Parameters: name - associate address with name |
addSendTo | public void addSendTo(String address) throws EmailSenderException(Code) | | Add a send to address to the email.
Parameters: address - address to send the email to |
addSendTo | public void addSendTo(String address, String name) throws EmailSenderException(Code) | | Add a send to address to the email.
Parameters: address - address to send the email to Parameters: name - associate address with name |
addText | public void addText(String textMessage)(Code) | | Add a text message to the email.
Parameters: textMessage - the text message |
getJavaMailMessage | public Message getJavaMailMessage()(Code) | | Return the actual JavaMail Message object.
|
getJavaMailSession | public Session getJavaMailSession()(Code) | | Return the actual JavaMail Session object.
session object |
sendEmail | public static void sendEmail(String host, InternetAddress addressFrom, InternetAddress addressTo, String subject, String message) throws EmailSenderException(Code) | | Convenience method for sending simple emails.
Parameters: host - the email server host address Parameters: addressFrom - the email address the email is being sent from Parameters: addressTo - the email address the email is being sent to Parameters: subject - the subject of the email Parameters: message - the email message |
sendEmail | public static void sendEmail(String host, String userId, String password, InternetAddress addressFrom, InternetAddress addressTo, String subject, String message) throws EmailSenderException(Code) | | Convenience method for sending simple emails.
Parameters: host - the email server host address Parameters: userId - the userid for the email host Parameters: password - the password for the email host Parameters: addressFrom - the email address the email is being sent from Parameters: addressTo - the email address the email is being sent to Parameters: subject - the subject of the email Parameters: message - the email message |
sendEmail | public static void sendEmail(InternetAddress addressFrom, InternetAddress addressTo, String subject, String message) throws EmailSenderException(Code) | | Convenience method for sending simple emails.
Parameters: addressFrom - the email address the email is being sent from Parameters: addressTo - the email address the email is being sent to Parameters: subject - the subject of the email Parameters: message - the email message |
sendEmail | public static void sendEmail(String host, String addressFrom, String fromName, String addressTo, String toName, String subject, String message) throws EmailSenderException(Code) | | Convenience method for sending simple emails.
Parameters: host - the email server host address Parameters: addressFrom - the email address the email is being sent from Parameters: fromName - the name of the email sender Parameters: addressTo - the email address the email is being sent to Parameters: toName - the name the email is being sent to Parameters: subject - the subject of the email Parameters: message - the email message |
sendEmail | public static void sendEmail(String host, String userId, String password, String addressFrom, String fromName, String addressTo, String toName, String subject, String message) throws EmailSenderException(Code) | | Convenience method for sending simple emails.
Parameters: host - the email server host address Parameters: userId - the userid for the email host Parameters: password - the password for the email host Parameters: addressFrom - the email address the email is being sent from Parameters: fromName - the name of the email sender Parameters: addressTo - the email address the email is being sent to Parameters: toName - the name the email is being sent to Parameters: subject - the subject of the email Parameters: message - the email message |
sendEmail | public static void sendEmail(String addressFrom, String fromName, String addressTo, String toName, String subject, String message) throws EmailSenderException(Code) | | Convenience method for sending simple emails.
Parameters: addressFrom - the email address the email is being sent from Parameters: fromName - the name of the email sender Parameters: addressTo - the email address the email is being sent to Parameters: toName - the name the email is being sent to Parameters: subject - the subject of the email Parameters: message - the email message |
setDebug | public void setDebug(boolean debug)(Code) | | Turns debugging on or off.
Parameters: debug - true if debugging, false if not. |
setSentFrom | public void setSentFrom(String address, String name) throws EmailSenderException(Code) | | Set the from address for the email.
Parameters: address - address from Parameters: name - associate address with name |
setSubject | public void setSubject(String subject) throws EmailSenderException(Code) | | Set the subject of the email message.
Parameters: subject - the subject of the email |
|
|