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
Harvey JethroHarvey Jethro 

First column removed from attachment in Email to Case functionality

Hi All,

I created the Apex class below to create attachments using the blob class. The attachment are from the HTML version of emails. 

I'm getting the attachemnts but the first coloum of the HTML table is removed.

Thanks!

Additionally, 

I found out that I can parse incoming HTML email content from this link https://developer.salesforce.com/forums/?id=906F0000000934IIAQ. 
The issue I'm having with this solution is that Blob will not accept array of strings. 
global class EmailtooCaseExample implements Messaging.InboundEmailHandler {
   
  
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.Inboundenvelope env) 
    {
         String myHtmlBody = email.HtmlBody;
        final String className = 'EmailtooCase';
        String METHOD_NAME='handleInboundEmail';
        
            
        String caseNum='';
        String toAddress='';
        String toAddresses='';
        String ccAddresses='';
        String forwardingEmails='';
       
        
        
        String myBody = email.plainTextBody;
       
        
        
      
        Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
   
         
        try{
                                   
                                   
                                    Attachment newment = new Attachment(
                                    ParentId = '5XX77111116MqZqANK',
                                    Name = 'letstest.pdf',
                                    ContentType = 'application-pdf',
                                    Body = blob.topdf(email.HtmlBody));
                                 
                               Database.insert(newment);                   
                            
           }
                             
        catch(DmlException e) {System.debug('The following exception has occurred: ' + e.getMessage());
           }

        return result;
    }
    
    

}

The Actual HTML TableThe Corrupted Table