0
我在Spring中使用SimpleMailMessage和MailSender发送邮件。我已经配置.xml文件作为使用MailSender发送邮件
<bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" >
<property name="host" value="smtp.gmail.com" />
<property name="port" value="465" />
<property name="protocol" value="smtps"></property>
<property name="username" value="[email protected]" />
<property name="password" value="passward" />
<property name="endoding" value="UTF-8"></property>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtps.auth">true</prop>
</props>
</property>
<bean id="userRegistrationService" class="UserRegistrationService">
<property name="mailSender" ref="mailSender" />
<property name="userEmailIds">
<set>
<value>[email protected]</value>
<value>[email protected]</value>
</set>
</property>
</bean>
</bean>
,但我得到的错误:
Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required.
Learn more at
530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 i7sm235670pbj.90
可能是什么原因?
它可能没有关系,但你必须在属性拼错“编码”,它是目前“endoding”。 – deltaforce2 2011-06-08 07:21:37