I've got a problem with sending Multi-Part email using Spring's
JavaMailSender.

It works fine without the multi-part (modified from the example in
Spring documentation):

final MimeMessagePreparator preparator = new MimeMessagePreparator() {
    public void prepare(final MimeMessage mimeMessage) throws Exception {
        final MimeMessageHelper message = new MimeMessageHelper(
                mimeMessage);
        message.setTo(toAddress);
        message.setFrom(fromAddress);
        message.setSubject(subject);
        final String htmlText = FreeMarkerTemplateUtils
                .processTemplateIntoString(configuration
                        .getTemplate(htmlTemplate), model);
        message.setText(htmlText, true);
    }
};
mailSender.send(preparator);

But once I change it to:

final MimeMessagePreparator preparator = new MimeMessagePreparator() {
    public void prepare(final MimeMessage mimeMessage) throws Exception {
        final MimeMessageHelper message = new MimeMessageHelper(
                mimeMessage, true);
...
        message.setText(plainText, htmlText);
    }
};
mailSender.send(preparator);

I get:

Failed message 1:
javax.mail.MessagingException: Converting attachment data failed
    at
com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:231)
    at
org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:402)
...

This is especially difficult since the GMTransport is proprietary Google
class and no source is available, which makes it pretty difficult to
debug. Anyone have any ideas what to try next?

My bean config, for helping you to help me:

<bean id="mailSender"
class="org.springframework.mail.javamail.JavaMailSenderImpl"
        p:username="${mail.username}" p:password="${mail.password}"
        p:protocol="gm" />

The question is also asked at Stack Overflow:
http://stackoverflow.com/questions/2686889/sending-multi-part-email-from-google-app-engine-using-springs-javamailsender-fai


Best Regards,
Hannu

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to