Отправить Spring Boot простое электронное письмо ⇐ JAVA
-
Anonymous
Отправить Spring Boot простое электронное письмо
I'm trying to send an email using Spring Boot. However, I get the error below in the console. I try the whole thing with GMX as email provider
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.mail.MailSendException: Mail server connection failed. Failed messages: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate); message exceptions (1) are: Failed message 1: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)] with root cause
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
Main Code:
@Autowired private JavaMailSender javaMailSender; private void sendMail() { SimpleMailMessage msg = new SimpleMailMessage(); msg.setTo("to_1@gmail.com", "to_2@gmail.com", "to_3@yahoo.com"); msg.setSubject("Testing from Spring Boot"); msg.setText("Hello World \n Spring Boot Email"); javaMailSender.send(msg); } pom.xml
org.springframework spring-context-support 5.2.8.RELEASE javax.mail mail 1.4.7 org.springframework.boot spring-boot-starter-mail application.properties file:
spring.mail.protocol=smtp spring.mail.host=mail.gmx.net spring.mail.properties.mail.smtp.ssl.trust=mail.gmx.net spring.mail.port=587 spring.mail.username=XYZ@gmx.de spring.mail.password=xyz # Other properties spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.connectiontimeout=5000 spring.mail.properties.mail.smtp.timeout=5000 spring.mail.properties.mail.smtp.writetimeout=5000 # TLS , port 587 spring.mail.properties.mail.smtp.starttls.enable=true
Источник: https://stackoverflow.com/questions/751 ... mple-email
I'm trying to send an email using Spring Boot. However, I get the error below in the console. I try the whole thing with GMX as email provider
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.mail.MailSendException: Mail server connection failed. Failed messages: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate); message exceptions (1) are: Failed message 1: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)] with root cause
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
Main Code:
@Autowired private JavaMailSender javaMailSender; private void sendMail() { SimpleMailMessage msg = new SimpleMailMessage(); msg.setTo("to_1@gmail.com", "to_2@gmail.com", "to_3@yahoo.com"); msg.setSubject("Testing from Spring Boot"); msg.setText("Hello World \n Spring Boot Email"); javaMailSender.send(msg); } pom.xml
org.springframework spring-context-support 5.2.8.RELEASE javax.mail mail 1.4.7 org.springframework.boot spring-boot-starter-mail application.properties file:
spring.mail.protocol=smtp spring.mail.host=mail.gmx.net spring.mail.properties.mail.smtp.ssl.trust=mail.gmx.net spring.mail.port=587 spring.mail.username=XYZ@gmx.de spring.mail.password=xyz # Other properties spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.connectiontimeout=5000 spring.mail.properties.mail.smtp.timeout=5000 spring.mail.properties.mail.smtp.writetimeout=5000 # TLS , port 587 spring.mail.properties.mail.smtp.starttls.enable=true
Источник: https://stackoverflow.com/questions/751 ... mple-email