| java.lang.Object com.methodhead.mail.Mail
Mail | public class Mail (Code) | | Provides simplified interface for sending email messages. This class uses
the Jakarta Commons Email API to send messages.
|
Method Summary | |
public static void | init(Properties props)
Sets the properties that contain configuration parameters.
JavaMail is used to send mail, and these properties are
passed directly to JavaMail classes. | protected static boolean | isValidAddress(String address) Utility method to validate an email address. | public static HtmlEmail | newHtmlEmail() Instantiates and initializes a new HtmlEmail (not unit tested). | public static MultiPartEmail | newMultiPartEmail() Instantiates and initializes a new MultiPartEmail (not unit
tested). | public static SimpleEmail | newSimpleEmail() Instantiates and initializes a new SimpleEmail (not unit tested). | public static void | send(String[] to, String from, String subject, String text) Sends text with subject to each email address in
to. | public static void | send(String to, String from, String subject, String text) Sends text with subject to to. | public static void | send(String[] to, String from, String subject, String text, String html) Sends text and html with subject to each email
address in to. | public static void | send(String[] to, String from, String subject, String text, File[] attachments) Sends text with subject and attachments to each
email address in to. | public static void | send(String[] to, String from, String subject, String text, String html, File[] attachments) Sends text and html with subject and
attachments to each email address in to. |
init | public static void init(Properties props)(Code) | |
Sets the properties that contain configuration parameters.
JavaMail is used to send mail, and these properties are
passed directly to JavaMail classes. The following
properties (and their default values) are important:
- mail.host (The local machine)
- mail.from (username@host)
Find information about all setting in Appendix A of the
JavaMail API Design Specification.
|
isValidAddress | protected static boolean isValidAddress(String address)(Code) | | Utility method to validate an email address.
|
newHtmlEmail | public static HtmlEmail newHtmlEmail()(Code) | | Instantiates and initializes a new HtmlEmail (not unit tested).
|
newMultiPartEmail | public static MultiPartEmail newMultiPartEmail()(Code) | | Instantiates and initializes a new MultiPartEmail (not unit
tested).
|
newSimpleEmail | public static SimpleEmail newSimpleEmail()(Code) | | Instantiates and initializes a new SimpleEmail (not unit tested).
|
send | public static void send(String[] to, String from, String subject, String text)(Code) | | Sends text with subject to each email address in
to. Any invalid email addresses in to are ignored, but
an invalid from address will throw an exception.
Note: Each message is sent individually; be aware of the
load on your mail server.
|
send | public static void send(String to, String from, String subject, String text) throws EmailException(Code) | | Sends text with subject to to. If to
is invalid, no email is sent, but an invalid from address will
throw an exception.
|
send | public static void send(String[] to, String from, String subject, String text, String html)(Code) | | Sends text and html with subject to each email
address in to. Any invalid email addresses in to are
ignored, but an invalid from address will throw an
exception. Note: Each message is sent
individually; be aware of the load on your mail server.
|
send | public static void send(String[] to, String from, String subject, String text, File[] attachments)(Code) | | Sends text with subject and attachments to each
email address in to. Any invalid email addresses in to
are ignored, but an invalid from address will throw an
exception. A null or non-existant file in attachments
will throw a MessagingException. Note: Each
message is sent individually; be aware of the load on your mail server.
|
send | public static void send(String[] to, String from, String subject, String text, String html, File[] attachments)(Code) | | Sends text and html with subject and
attachments to each email address in to. If
html is null, a text-only email is sent. Any invalid
email addresses in to are ignored, but an invalid from
address will throw an exception. A null or non-existant
file in attachments will throw a MessagingException.
Note: Each message is sent individually; be aware of the
load on your mail server.
|
|
|