You need to sign in to do that
Don't have an account?

Email Attachment - ContentType
I am attempting to parse out the values from attachments in emails which are coming in through Email Service. However, some emails have other attachments in them which are not UTF-8 format (sometimes they're graphics files in an email signature). So the code will error when attempting to scan those files. So I'm trying to skip over the files whose content type is not text-based.
I am getting this error when attempting to save it :
"variable does not exist : contentType"
This is an early portion of my code
Thank you for any help you can provide.
I am getting this error when attempting to save it :
"variable does not exist : contentType"
This is an early portion of my code
if (email.binaryAttachments != null && email.binaryAttachments.size() > 0) { Map<Id, Program_Contact_Role__c> mapPCRsWithProgram = new Map<Id, Program_Contact_Role__c>(); //List to hold Content versions List<ContentVersion> contentVersions = new List<ContentVersion>(); for(integer i =0, s = email.binaryattachments.size(); i < s; i++) { if(email.binaryAttachments[i].contentType.startsWith('text/')) { try { //Get Attachment details List<String> attachmentSplitsByRows = new List<String>(); //Insatnce of attachemnts Attachment attachment = new Attachment(); // Get attachment name and body attachment.Name = email.binaryAttachments[0].filename; attachment.Body = email.binaryAttachments[0].body;
Thank you for any help you can provide.