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