I am trying to send an E-Mail with an Excel Attachment. Everything works, except I am getting a warning when I am trying to open the send attachment:
The file format and extension of 'ExcelfileSC.xls' don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?
Here is the relevant part of my code:
Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
attach.ContentType = 'application/vnd.ms-excel; charset=UTF-8';
blob excel = blob.valueOf('\uFEFF'+finalstr);
attach.setBody(excel);
attach.setFileName('ExcelfileSC.xls');
I am setting the right filename and contenttype, so why does the format + extension not match?
\uFEFF
prefix?