Sidebar

ClassCastException: Cannot cast java.lang.String to java.util.Map when trying to use the qie.sendEmail function

0 votes
282 views
asked May 5, 2015 by russell-c-4612 (140 points)

Keep getting the following error while trying to utilize the qie.sendEmail function.

ClassCastException: Cannot cast java.lang.String to java.util.Map

1 Answer

0 votes

This is caused when you pass a string as the final paramater for the qie.sendEmail() function instead of an emailAttachmentMap.

You need to create an emailAttachmentMap and then add your attachments to this map before calling the qie.sendEmail().  Once you have done this, you will pass the emailAttachmentMap as the final paramater in the call.

var attachmentMap = qie.newEmailAttachmentMap();
qie.addEmailAttachment(attachmentMap, 'file.name', source.getBytes());
qie.sendEmail('email@host.com', 'test attachment', 'here is the attachment', attachmentMap);

 

See: https://www.qvera.com/kb/index.php/470/can-i-email-an-attachment-in-a-channel

 

answered May 5, 2015 by ben-s-7515 (11,100 points)
...