0

我使用appfuse 快速入门创建了一个基本的 Spring MVC 项目。

mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=3.0.0 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse 

我在https://mailtrap.io(一个虚假的 smtp 服务)上注册了。mail.properties我使用邮件陷阱凭据编辑了文件:

mail.default.from=AppFuse <appfuse@raibledesigns.com>
mail.host=mailtrap.io
mail.username=199******d30ac
mail.password=ca8******aae39

我启动了该应用程序并尝试注册一个新用户,但我得到了:

ERROR [qtp8455718-31] MailEngine.send(78) | Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.1 Authentication required

我仔细检查了凭据,我确定它们是正确的。

我用谷歌搜索并找到了MailEngine 的源代码,它看起来像一个包装器org.springframework.mail.MailSender

我有点失望,我认为 appfuse 应该开箱即用。

4

2 回答 2

1

这是邮件列表中一个看起来相似的主题:

http://appfuse.547863.n4.nabble.com/SMTP-Authentication-with-Struts-2-App-td560701.html

于 2014-04-28T16:15:41.197 回答
1

确保您已正确编辑(参见粗体注释)applicationContext-service.xml 文件中的以下部分:

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
   <property name="host" value="${mail.host}"/>
   <property name="defaultEncoding" value=" UTF-8"/>
   <!-- 如果您需要使用 SMTP 服务器进行身份验证,请取消注释 -->
   <!--property name="username" value="${mail.username}"/>
   <property name="密码" value="${mail.password}"/>
   <property name="javaMailProperties">
       <value>
        mail.smtp.auth=true
       </value>
    </property-->

</bean>

希望有帮助。

于 2014-06-28T09:21:41.837 回答