function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Leo DarkstarLeo Darkstar 

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
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++) 


                    //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.