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
Sateesh KumarSateesh Kumar 

Test Class

CAN SOME ONE HELP ME WITH TEST CLASS.

global class CreateTaskAttchmentEmailExample implements Messaging.InboundEmailHandler {     global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,                                                         Messaging.InboundEnvelope env){       Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();        String myPlainText= '';     myPlainText = email.plainTextBody;          Task[] newTask = new Task[0];     try {       Contact vCon = [SELECT Id, Name, Email         FROM Contact         WHERE Email = :email.toAddresses          LIMIT 1];              newTask.add(new Task(            Priority = 'Normal',            Status = 'Inbound Email',            Subject = email.subject,                       WhoId =  vCon.Id));            insert newTask;           system.debug('===Addresses==>>>'+vCon.Id);      System.debug('New Task Object: ' + newTask );         Attachment attachment = new Attachment();        attachment.Body = Blob.valueOf(email.plainTextBody);        attachment.Name = email.subject;        attachment.ParentId = vCon.Id;        insert attachment;     }         catch (QueryException e) {     System.debug('Query Issue: ' + e);    }    result.success = true;    return result;   } }
PratikPratik (Salesforce Developers) 
Hi Sateesh,

Hre is the sample code:
https://developer.salesforce.com/page/Code_Sample_-_Testing_Email_Services_with_Inbound_Attachments

Thanks,
Pratik