I'm trying to send a very simple email with org.springframework.mail.javamail.JavaMailSenderImpl. Below is the code :
SimpleMailMessage mailMessage = new SimpleMailMessage();
mailMessage.setTo(request.getCustomerEmail());
mailMessage.setSubject("someSubject");
mailMessage.setFrom("[email protected]");
mailSender.send(mailMessage);
This is the exception I get :
Caused by: org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: No MimeMessage content
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:459)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
I really don't understand why this happens..
Any idea ?
After a couple of hours of struggling, I've found that this is all because the mail I'm creating has no text !
If I add this line, then it works like a charm :
mailMessage.setText("blabla");
I really got confused by the "No MimeMessage content" message.. Does anybody agree that the message could be more informative, or is it only me ? Does this mean we can't send an email with just a subject and no content ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With