I try to perform a service to send emails from my application. I have the Bean configured as follows:
<bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" >
<property name="host" value="smtp.gmail.com"/>
<property name="port" value="587"/>
<property name="protocol" value="smtp"/>
<property name="username" value="[email protected]"/>
<property name="password" value="XXX"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtp.quitwait">false</prop>
</props>
</property>
</bean>
The problem comes when I run the mailSender.send () method, which I skipped the following exception:
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException
Following the behavior of the program with the debugger, I see that it reaches the transport.connect(getHost(), getPort(), username, password);
within JavaMailSenderImpl.
the parameters correspond correctly with what is defined in my xml file, so I guess the user or password is failing me. which correspond to my email account and password.
I already have access to unsafe applications. Thank you very much.