Package gda.util
Class Email
java.lang.Object
gda.util.Email
Utility builder for sending emails.
Messages can be built and sent with a fluent api, eg
new Email().to("foobar@diamond.ac.uk")
.subject("This is a test message")
.message("This is the message body")
.attach("/path/to/file")
.attach("/path/to/additional_file")
.send();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd an attachment to this messageattach(Collection<String> attachments) Add an attachment to this messageAdd addresses to be included in the BCC list of this messagebcc(Collection<String> bcc) Add addresses to be included in the BCC list of this messageAdd addresses to be included in the CC list of this messagecc(Collection<String> cc) Add addresses to be included in the CC list of this messageSet the address that this message will appear to be fromSet the body text of this messagevoidsend()Send messageFuture<?> Send message in a background threadSet the subject of this messageAdd addresses to be the main recipients of this messageto(Collection<String> address) Add addresses to be the main recipients of this message
-
Constructor Details
-
Email
public Email()
-
-
Method Details
-
to
Add addresses to be the main recipients of this message -
to
Add addresses to be the main recipients of this message -
cc
Add addresses to be included in the CC list of this message -
cc
Add addresses to be included in the CC list of this message -
bcc
Add addresses to be included in the BCC list of this message -
bcc
Add addresses to be included in the BCC list of this message -
subject
Set the subject of this message -
message
Set the body text of this message -
attach
Add an attachment to this message -
attach
Add an attachment to this message -
from
Set the address that this message will appear to be from -
send
public void send() throws javax.mail.MessagingExceptionSend message- Throws:
javax.mail.MessagingException
-
sendAsync
Send message in a background thread- Returns:
- a future giving access to the completion status
-