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.