Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.core;
import org.apache.log4j.Logger;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
/**
* Class representing an e-mail message, also used to send e-mails.
*
* Typical use:
*
* Email email = ConfigurationManager.getEmail(name);
* email.addRecipient("[email protected]");
* 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: 5844 $
*/
public class Email
{
/*
* Implementation note: It might be necessary to add a quick utility method
* like "send(to, subject, message)". We'll see how far we get without it -
* having all emails as templates in the config allows customisation and
* internationalisation.
*
* Note that everything is stored and the run in send() so that only send()
* throws a MessagingException.
*/
/** The content of the message */
private String content;
/** The subject of the message */
private String subject;
/** The arguments to fill out */
private List