The program worked when i tried sending from my gmail account to zoho mail, of course by using different smtp settings. This proofs that the program is not the culprit.
Here are my zoho mail setting :
<property name="host" value="smtp.zoho.com" />
<property name="port" value="465" />
<property name="protocol" value="smtp" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
<property name="javaMailProperties">
<props>
<prop key="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
<prop key="mail.smtp.socketFactory.fallback">false</prop>
<prop key="mail.smtp.socketFactory.port">465</prop>
<prop key="mail.smtp.startssl.enable">true</prop>
</props>
</property>
And the sending takes a long time before failing with this exception :
Exception in thread "main" org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.ma
il.MessagingException: Could not connect to SMTP host: smtp.zoho.com, port: 465, response: -1. Failed messages: javax.mail.Messagi
ngException: Could not connect to SMTP host: smtp.zoho.com, port: 465, response: -1; message exception details (1) are:
Failed message 1:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.zoho.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1949)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
at javax.mail.Service.connect(Service.java:295)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:306)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
at mail.Mailer.sendPlainMail(Mailer.java:25)
at mail.Mailer.main(Mailer.java:37)
I have tried this several times with the same output,
so w
hat did i do wrong ?