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
AzarudeenAzarudeen 

Email service (not supported Company ID)

When i send an email(company address) to activated salesforce EmailID. Msg is not Delivered. but yahoo,gmail are working . plz help me

 

This is my code.

 

Global class unsubscribe implements Messaging.inboundEmailHandler{
Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,Messaging.InboundEnvelope env )
 {

Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
 
String strEmailId = email.fromAddress.toLowerCase();
String strSubject = email.subject.toLowerCase();
String emailBody1 = email.plainTextBody.toLowerCase();



String[] strTemp=strEmailId.split('@',0);  
String temp = strTemp[1];
String[] comp=temp.split('\\.',0);     
String compa = comp[0].toLowerCase();            
 
 integer iCount;
 iCount = [select count() from Lead where Email=:email.fromAddress];
 
   if (iCount==0)
   {   
   Lead l = new lead(
           lastName='Mailing Lead1',                
           Email=strEmailId,                    
           Company=compa,
           Title=strSubject,
           Description=emailBody1,
           HasOptedOutOfEmail=true,
           OwnerId='00590000000lKc5AAE');
       
   insert l;
   }
 
result.success = true;
return result;
    }  

}