dk.netarkivet.common.utils
Class EMailUtils
java.lang.Object
dk.netarkivet.common.utils.EMailUtils
public class EMailUtils
- extends java.lang.Object
Utilities for sending an email.
Method Summary |
static void |
sendEmail(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body)
Send an email, throwing exceptions on errors. |
static void |
sendEmail(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body,
boolean forgive)
Send an email, possibly forgiving errors. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMailUtils
public EMailUtils()
sendEmail
public static void sendEmail(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body)
- Send an email, throwing exceptions on errors.
- Parameters:
to
- The recipient of the email. Separate multiple recipients with
commas.from
- The sender of the email.subject
- The subject of the email.body
- The body of the email.
- Throws:
ArgumentNotValid
- If either parameter is null, if to, from or
subject is the empty string, if to or from
does not contain valid email adresses.
IOFailure
- If the message cannot be sent for some reason.
sendEmail
public static void sendEmail(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body,
boolean forgive)
- Send an email, possibly forgiving errors.
- Parameters:
to
- The recipient of the email. Separate multiple recipients with
commas. Supports only adresses of the type 'john@doe.dk', not
'John Doe 'from
- The sender of the email.subject
- The subject of the email.body
- The body of the email.forgive
- On true, will send the email even on invalid email
addresses, if at least one recipient can be set, on false, will
throw exceptions on any invalid email address.
- Throws:
ArgumentNotValid
- If either parameter is null, if to, from or
subject is the empty string, or no recipient
can be set. If "forgive" is false, also on
any invalid to or from address.
IOFailure
- If the message cannot be sent for some reason.