Frage

There is no problem when I send TEXT email using our portal which is using java mail however, when I chose to put HTML content and send the email, the following alert is raised. spend hours searching but no useful answer!

Can anyone please help

Email with subject:Your Test-Customer, email destination address :john@smith.com, from:Peter has not been delivered because: javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.IOException: javax.mail.MessagingException: Empty multipart: multipart/mixed; boundary="----=_Part_647_32892086.1397180117482" at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1167) at javax.mail.Transport.send0(Transport.java:254) at javax.mail.Transport.send(Transport.java:124)

Any idea why this happens when I put html?

Thanks,

War es hilfreich?

Lösung

You haven't given all the information like code snippet. So I am assuming some factors and giving you the suggestion. Whenever you want to send html content via email, you have to make a MIME message and then have to define content type as text/html. This can be the possible reason of exception.

I am putting a code snippet for your reference. May this help.

 Message message = new MimeMessage(session);
 message.setFrom("fromAddress");
 message.setRecipients(Message.RecipientType.TO,"toAddress");
 message.setSubject("subject");
 message.setContent("Your HTML Content", "text/html"); 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top