Home  >  Forum  >  Spring
Post New Query

Not in multipart mode - create an appropriate MimeMessageHelper


joined on
August 11,2014
Asked on February 25,2015
Hi Friends,

I am new in email API. I am trying  to send email using spring and Gmail SMTP and getting below error.


DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'javaMailSenderImpl'
Exception in thread "main" java.lang.IllegalStateException: Not in multipart mode - create an appropriate MimeMessageHelper via a constructor that takes a 'multipart' flag if you need to set alternative texts or add inline elements or attachments.
at org.springframework.mail.javamail.MimeMessageHelper.checkMultipart(MimeMessageHelper.java:383)
at org.springframework.mail.javamail.MimeMessageHelper.getRootMimeMultipart(MimeMessageHelper.java:400)
at org.springframework.mail.javamail.MimeMessageHelper.addAttachment(MimeMessageHelper.java:998)
at org.springframework.mail.javamail.MimeMessageHelper.addAttachment(MimeMessageHelper.java:1022)
joined on
October 10,2013
Replied on February 25,2015

Create MimeMessageHelper by passing true

MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage, true);

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us