request.getSomething//发送验证邮件

<span style="font-family: 'ms shell dlg'; background-color: rgb(255, 255, 255);">request.getSchema()</span><span style="font-family: 'ms shell dlg'; background-color: rgb(255, 255, 255);"> </span><span style="font-family: 'ms shell dlg'; background-color: rgb(255, 255, 255);">返回当前页面使用的协议,http 或是 https;</span>

request.getServerName() 返回当前页面所在的服务器的名字;

request.getServerPort() 返回当前页面所在的服务器使用的端口,就是80;

request.getContextPath() 返回当前页面所在的应用的名字;

    /**
     * 添加注册信息,发送验证邮件
     *
     * @return
     * @throws Exception
     */
    public String add() throws Exception {
        HttpServletRequest request = ServletActionContext.getRequest();
        ShoppingCust shoppingLoginUser = new ShoppingCust();
        shoppingLoginUser.setUsername(request.getParameter("username"));
        shoppingLoginUser.setEMail(request.getParameter("eMail"));
        shoppingLoginUser.setState("0");
        //shoppingLoginUser.setLastVisitUrl("");
        shoppingLoginUser.setPassword(request.getParameter("password"));
        int primaryKey = shoppingCustService.insert(shoppingLoginUser);
        StringBuffer email_content = new StringBuffer();
        email_content.append("尊敬的<font color='red' font-size='20px;'>" + shoppingLoginUser.getUsername() + "</font>:<br/>");
        email_content.append("请点击下面的链接以验证您的邮箱(若链接不可点击,请复制并粘帖该链接到浏览器地址栏中访问)。");
        email_content.append("<a href='");
        email_content.append(request.getScheme());
        email_content.append("://");
        email_content.append(request.getServerName());
        email_content.append(":");
        email_content.append(request.getServerPort());
        email_content.append(request.getContextPath());
        email_content.append("/register_activeAccount.do?");
        email_content.append(new DESPlus().encrypt("loginUserId=" + primaryKey + "&nowDate=" + System.currentTimeMillis()));
        email_content.append("'>");
        email_content.append(request.getScheme());
        email_content.append("://");
        email_content.append(request.getServerName());
        email_content.append(":");
        email_content.append(request.getServerPort());
        email_content.append(request.getContextPath());
        email_content.append("/register_activeAccount.do?");
        email_content.append(new DESPlus().encrypt("loginUserId=" + primaryKey + "&nowDate=" + System.currentTimeMillis()));
        email_content.append("</a><br/>");
        email_content.append("若您并未在天津分销网站上注册,请忽略本邮件,链接将自动失效。<br/>");
        email_content.append("该邮件由系统发送,请勿回复<br/>");
        email_content.append("天津分销系统<br/>");
        request.setAttribute("mailbox", shoppingLoginUser.getEMail());
        SendMail.sendMailToAccount(shoppingLoginUser.getEMail(), "天津分销系统注册激活", email_content.toString(), "html");

        return "getMail";
    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值