public final class EMailUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
sendEmail(String to,
String from,
String subject,
String body)
Send an email, throwing exceptions on errors.
|
static void |
sendEmail(String to,
String from,
String subject,
String body,
boolean forgive)
Send an email, possibly forgiving errors.
|
public static void sendEmail(String to, String from, String subject, String body)
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.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.public static void sendEmail(String to, String from, String subject, String body, boolean forgive)
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.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.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.