最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

email - Java Spring app mail Gmail OK but not working with OVH - Stack Overflow

programmeradmin4浏览0评论

I built a Java Spring app that send mail through an OVH configuration, where I have a domain name and a mail service. To test on my localhost, I also tried to send mail with a Gmail configuration, which is working well. With the OVH configuration, I don't have any issue, except that I never receive the mail.

Do you have any advice to look at and that could cause the OVH service to be unsuccessful ?

Here is my configuration :

spring:
  mail:
    host: ssl0.ovh #smtp.gmail
    port: 587
    username: [email protected] #[email protected]
    password: password
    properties:
      mail:
        transport.protocol: smtp
        smtp:
          auth: true
          starttls:
            enable: true
            required: true
    test-connection: true

Thanks !

I built a Java Spring app that send mail through an OVH configuration, where I have a domain name and a mail service. To test on my localhost, I also tried to send mail with a Gmail configuration, which is working well. With the OVH configuration, I don't have any issue, except that I never receive the mail.

Do you have any advice to look at and that could cause the OVH service to be unsuccessful ?

Here is my configuration :

spring:
  mail:
    host: ssl0.ovh #smtp.gmail
    port: 587
    username: [email protected] #[email protected]
    password: password
    properties:
      mail:
        transport.protocol: smtp
        smtp:
          auth: true
          starttls:
            enable: true
            required: true
    test-connection: true

Thanks !

Share Improve this question asked Mar 23 at 1:48 BabCBabC 1,0848 silver badges21 bronze badges 2
  • Are you sure SMTP port for OVH is 587 not 465 ? – p3consulting Commented Mar 23 at 12:23
  • I tried both 587 and 465 with the same result – BabC Commented Mar 23 at 15:53
Add a comment  | 

1 Answer 1

Reset to default 0

So after many hours looking for configuration on OVH website, I tried a node app... And it worked well. So the issue is in my java application.

I took a look at my parameters, and within my message I didn't fill all the informations, the recipient was missing. Apparently it doesn't bother gmail, but with OVH it won't work.

Here is the minimalist code to send the mail :

public void send() {
    SimpleMailMessage message = new SimpleMailMessage();
    message.setFrom("[email protected]");
    message.setTo("[email protected]");
    message.setSubject("Subject");
    message.setText("Body");
    mailSender.send(message);
}

And the configuration on my question is correct.

发布评论

评论列表(0)

  1. 暂无评论