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
mallikharjunarao gundamallikharjunarao gunda 

InboudEmailservices in inline image not appear on richtextarea(customfield)

 HI all
 I try to this code no errors, when i insert the caserecord . image will not appear on the richtextarea field
see this code
global class InboundEmailexample implements Messaging.InboundEmailHandler{
global messaging.InboundEmailResult handleinboundemail(Messaging.InboundEmail email,messaging.InboundEnvelope envp){
    
 
    Messaging.InboundEmailResult result=new Messaging.InboundEmailResult();
   
     
            Case c=new Case();
            c.origin='Email';
            c.Priority='Normal';
            c.Status='Open';
            c.subject=email.subject;
              c.texxtimages__c=email.htmlBody;
          insert c;
           
     map<string,attachment> mapattachement=new map<string,attachment>();
    if(email.binaryAttachments!=null){
    for(Messaging.Inboundemail.BinaryAttachment ba : email.binaryAttachments) {
        system.debug(ba);
        for(integer i=0; i<ba.headers.size(); i++){
            string headervalue=ba.headers[i].value;
            system.debug('head'+headervalue);
            system.debug('headername'+headervalue);
          if(headerValue.startsWith('ii') || headerValue.startsWith('< image')) {
      headerValue = headerValue.replaceAll('<', '').replaceAll('>', '');
   mapattachement.put(headerValue, new Attachment(Name = bA.fileName, body = bA.body, 
                  ParentId = c.Id, ContentType = bA.mimeTypeSubType));
                }
        }
        }
    }
    
   
    insert mapattachement.values();
   
for(String headerValue :mapattachement.keySet()) {
    system.debug(headerValue);
    
            //Reference Link
            String refLink = '/servlet/servlet.FileDownload?file=' +mapattachement.get(headerValue).Id;
            c.texxtimages__c = c.texxtimages__c    .replaceAll('cid:' +headerValue, refLink);
        }
      update c;
        
    
        return result;
    
    
    
    }
    

}
SandhyaSandhya (Salesforce Developers) 
Hi mallikharjunarao gunda,

I have not tried this, but after some research, I found this from below link see if that helps you.
 
Salesforce process inline images as binary attachments. When you send an email having inline images, it doesn’t come as a part of the body, but it comes as a binary attachment. From here, you will have to put your own logic to place the inline images back in HTML Body.

http://simplyforce.blogspot.sg/2014/08/handling-inline-images-in-salesforce.html
 
Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
 
Thanks and Regards
Sandhya