spring mvc邮箱激活功能

想做个邮箱激活功能模块,但是不知道从哪里下手,框架为spring spring mvc mybaits。 请大牛分析思路,有demo最好。

阅读 3.4k
1 个回答

clipboard.png
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"

xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <!-- 基于校验规则的邮件发送方式 -->
    <!-- SMTP协议介绍 -->
    <property name="host" value="smtp.126.com" />
    <property name="username" value="itcast0228" />
    <property name="password" value="0228itcast" />
    <property name="javaMailProperties">
        <props>
            <!-- 必须进行授权认证,它的目的就是阻止他人任意乱发邮件 -->
            <prop key="mail.smtp.auth">true</prop>
            <!-- SMTP加密方式:连接到一个TLS保护连接 -->
            <prop key="mail.smtp.starttls.enable">true</prop>
            <!-- 设置邮件发送超时时间 -->
            <prop key="mail.smtp.timeout">25000</prop>  
        </props>
    </property>
</bean>

</beans>

数据库成你可以有一个标记 如果是1就激活成功 当你点击了邮件的链接(包含用户的用户唯一信息)即可激活

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题