I am trying to find the correct properties to use to connect to the Gmail
SMTP sever using the JavaMailSenderImpl class.
Let me first say that I have tried the approach found here. This worked fine. But when I tried the configuration below that post with the exact same authentication information I received a javax.mail.AuthenticationFailedException.
My currently configuration looks like this.
<bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" >
<property name="username" value="
[email protected]" />
<property name="password" value="XXX" />
<property name="javaMailProperties">
<props>
<prop key="mail.
smtp.host">smtp.gmail.com</prop>
<prop key="mail.
smtp.port">587</prop>
<prop key="mail.
smtp.auth">true</prop>
<prop key="mail.
smtp.starttls.enable">true</prop>
</props>
</property>
</bean>
Why am I still getting this javax.mail.AuthenticationFailedException if I know that my credentials are correct.
Update
Here is my updated code based on the answers below. I am still receiving the same exception.
<bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" >
<property name="username" value="
[email protected]" />
<property name="password" value="XXX" />
<property name="javaMailProperties">
<props>
<prop key="mail.
smtp.from">
[email protected]</prop>
<prop key="mail.
smtp.user">
[email protected]</prop>
<prop key="mail.
smtp.password">XXX</prop>
<prop key="mail.
smtp.host">smtp.gmail.com</prop>
<prop key="mail.
smtp.port">587</prop>
<prop key="mail.
smtp.auth">true</prop>
<prop key="mail.
smtp.starttls.enable">true</prop>
</props>
</property>
</bean>