1

I have spring boot application and want's to send eamil using ionos. these are email configuration that i used:

@Configuration
public class MailConfiguration {

    @Autowired
    private Environment env;

    @Bean
    public JavaMailSender getMailSender() {
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();

        mailSender.setHost(env.getProperty("spring.mail.host"));
        mailSender.setPort(Integer.parseInt(env.getProperty("spring.mail.port")));
        mailSender.setUsername(env.getProperty("spring.mail.username"));
        mailSender.setPassword(env.getProperty("spring.mail.password"));

        return mailSender;
    }
}


spring:
  mail:
    host: smtp.ionos.com
    port: 465
    username: support@mysite.com
    password: password

with 465 port i get this error:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.ionos.com, port: 465, response: -1

and with 587 port, i didn't get any error, but also didn't receive any email email in inbox.

Rasool Ghafari
  • 4,128
  • 7
  • 44
  • 71

1 Answers1

3

If you're still stuck on this. Please check your DNS record with Ionos staff to make sure everything is as it should be and then - if it still isn't working, use Dror's answer from here because it worked for me.

Basically, the errors from Ionos are a red herring. You need to set the from field in your JavaMailSender method:

helper.setFrom(your email here); 

It's easy to overlook this because Gmail has looser sec protocols and doesn't need it.

Hope that helps.