日期:2014-05-17 浏览次数:20751 次
/**
* Created with IntelliJ IDEA.
* User: liuxiaochen
* Date: 13-9-22
* Time: 下午6:50
* 修改描述
*/
public class ActsocialMailSender {
//从配置文件中读取相应的邮件配置属性
private static final String emailHost = "smtp.gmail.com";
private static final String userName = "****@gmail.com";
private static final String password = "********";
private static final String mailAuth = "true";
private static Map<String, Object> proMap = null;
private static JavaMailSenderImpl instance = null;
private static VelocityEngine velocityEngine = null;
static {
proMap = new HashMap<String, Object>();
proMap.put("resource.loader", "class");
proMap.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
}
public static JavaMailSender getInstance() {
if (null == instance) {
synchronized (JavaMailSenderImpl.class) {
if (null == instance) {
instance = new JavaMailSenderImpl();
instance.setHost(emailHost);
instance.setUsername(userName);
instance.setPassword(password);
&n