codinglabs

Experiments and Notes …

Advertisement

You could set up dumbster which is especially useful to run unit test assertions against the messages that are sent and returned. Another quick way is to configure your application to use your Gmail account:

<bean id="javaMailSender"
class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com" />
<property name="port" value="465" />
<property name="username" value="xxxx@gmail.com" />
<property name="password" value="xxxx" />
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.debug">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
<prop key="mail.smtp.socketFactory.fallback">false</prop>
<prop key="mail.smtp.socketFactory.port">465</prop>
</props>
</property>
</bean>

The mail.debug option spills out the SMTP connection information to the console.
Port 465 is the default Gmail port. Happy mailing!

Popularity: 100% [?]

Comments

There are 2 comments for this post.

  1. Anonymous on December 9, 2007 8:06 am

    Hey,

    great post! i’ve been looking to test my java sender while sharing test code with
    the rest of my coders! simple and effective… thx

  2. Yuri on November 26, 2008 3:14 am

    Works as advertised! Thanks :-)

Write a Comment