You need to sign in to do that
Don't have an account?
send a mail to salesforce.com, create a lead
Global class unsubscribe implements Messaging.inboundEmailHandler{Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,Messaging.InboundEnvelope env ) {// Create an inboundEmailResult object for returning//the result of the Apex Email ServiceMessaging.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); // first split with @, you'll get [jaya, global.com] in arrayString temp = strTemp[1];String[] comp=temp.split('\\.',0); // again split 2nd element of array with dot(.)String compa = comp[0].toLowerCase(); // It shows the compny name 'global' in debug log
integer iCount; iCount = [select count() from Lead where Email=:email.fromAddress]; if (iCount==0) { Lead l = new lead( FirstName='Mailing Lead1', //firstname LastName='Mailing Lead1', //Lastname Email=strEmailId, //email Company=compa, //company Title=strSubject, // title Description=emailBody1, //description Status='Open-Not Contacted', HasOptedOutOfEmail=true, OwnerId='00590000000Oy12AAC'); insert l; } result.success = true;return result; } }