日期:2014-05-17  浏览次数:20713 次

网站开发中如何实现邮箱邦定。
本帖最后由 s781112 于 2013-12-06 15:17:53 编辑
 目前在开发一个网站,目前想实现邮箱邦定的功能,当用户按下绑定这个按钮后,网站会发一份邮件过去,然后邮件里面有个链接。点链接跳到网站一个页面,这个功能怎么实现。最要具体一点,能有代码,或者链接解决这类问题的。

------解决方案--------------------
/**
 * 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