Activity Forums Salesforce® Discussions How to insert Account from Inbound email Attachment having Thousands of record? Reply To: How to insert Account from Inbound email Attachment having Thousands of record?

  • Ajay Prakash

    Member
    April 1, 2016 at 6:47 am

    global class createAccountsFromMail implements Messaging.InboundEmailHandler{
    global String MyFile{get;set;}
    global String[] filelines = new String[]{};
    global List AccountList=new List();

    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope){
    Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
    try{
    System.debug('HELLO There');
    for(Messaging.Inboundemail.BinaryAttachment at : email.binaryAttachments){
    System.debug('Mail contents');
    MyFile=at.body.toString().substring(0,5000);
    filelines=MyFile.Split('\n');
    System.Debug('File Lines----'+filelines.size());
    for(Integer i=1;i