Typical use:
Email email = ConfigurationManager.getEmail(name);
email.addRecipient("foo@bar.com");
email.addArgument("John");
email.addArgument("On the Testing of DSpace");
email.send();
name
is the name of an email template in dspace-dir/config/emails/
(which also includes the subject.) arg0
and arg1
are arguments to fill out the message with.
Emails are formatted using java.text.MessageFormat.
Additionally, comment lines (starting with '#') are stripped, and if a line starts with "Subject:" the text on the right of the colon is used for the subject line. For example:
# This is a comment line which is stripped # # Parameters: {0} is a person's name # {1} is the name of a submission # Subject: Example e-mail Dear {0}, Thank you for sending us your submission "{1}".
If the example code above was used to send this mail, the resulting mail would have the subject Example e-mail
and the body would be:
Dear John, Thank you for sending us your submission "On the Testing of DSpace".
Note that parameters like {0}
cannot be placed in the subject of the e-mail; they won't get filled out.
@author Robert Tansley
@author Jim Downing - added attachment handling code
@version $Revision: 4659 $
|
|
|
|
|
|
|
|
|
|
|
|