I am using spring org.springframework.mail.javamail.JavaMailSender and i have below configuration
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com"/>
<property name="port" value="25"/>
<property name="username" value="******@gmail.com"/>
<property name="password" value="*******"/>
<property name="javaMailProperties">
<props>
<prop key="mail.transport.protocol">smtp</prop>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.debug">true</prop>
</props>
</property>
</bean>
Anyway, everything works as expected from my local tomcat, but tonight when I uploaded app to VPS (Ubuntu 14 on Linode hosting), it seems that gmail is refusing to authenticate my user and to send an email. I have already set to allow less secured apps on this account. The error I got is:
When I tried it for the second time, gmail emailed me that someone is trying to login to my account with correct username/password, and asked if it was me. I sad that that was me, but the problem remains...
Any ideas? Do I need to set something on my ubuntu? Or maybe I even cant use gmail smtp for this? I need it only for this test phase, later I will have other mail configuration.
Any quick info is appreciated. Thanks!
Update 1 I just run trought my gmail account security and I have found list of blocked attempts, so even they kept blocking it although I said it was me! I tried to find how to add this to trusted sources, but I found nothing... Any ideas?
Since I didnt find a way to tell gmail to stop blocking my own login request (It keeps blocking even after I said it was me...), I switched to yahoo smtp, and it works perfect! Here is my configuration:
<property name="host" value="smtp.mail.yahoo.com"/>
<property name="port" value="587 "/>
<property name="username" value="**********@yahoo.com"/>
<property name="password" value="*******"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.debug">true</prop>
</props>
</property>