1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
541 views
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

 

by ben-s-7515 (13.0k points)
...