Coach Thrasher

Tuesday Mar 31, 2009

GMail via Spring JavaMailSenderImpl

Sometimes I hate Google. It can give too many wrong answers. Yet, they look so enticing, like I'm a little kitten playing for hours with a ball of yarn. It gets me nothing.

None the less, here's how to properly configure Spring's JavaMailSenderImpl to -properly- send mail through Google Mail using your gmail account.


<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="defaultEncoding" value="UTF-8"/>
<property name="host" value="smtp.gmail.com"/>
<property name="port" value="465"/>
<property name="username" value="${mail.username}"/>
<property name="password" value="${mail.password}"/>
<property name="javaMailProperties">
<value>
mail.debug=true
mail.smtp.auth=true
mail.smtp.socketFactory.class=java.net.SocketFactory
mail.smtp.socketFactory.fallback=false
</value>
</property>
</bean>

Comments:

Post a Comment:
Comments are closed for this entry.

Calendar

Feeds

Search

Links

Navigation

Referrers