I have created a MailGateway for my application which uses a JDBCMessageStore to back to queue:
and configured it as follows:
This used to send SimpleMailMessage instances perfectly well. I have now found that to send HTML e-mail I need to use MimeMailMessage. However, I now get the following exception when I try to send an e-mail:
This makes sense because SimpleMailMessage is Serializable and MimeMailMessage is not. I'd like to know if anyone has any ideas to allow this to work? I can fix it for now by removing the JDBCMessageStore but am looking for something better!
@Gateway public void sendMail(OutgoingMailMessage recipient);
<channel id="outboundMailChannel" > <queue message-store="messageStore" /> </channel> <jdbc:message-store data-source="dataSource" id="messageStore" />
Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: org.springframework.mail.javamail.MimeMailMessage