You need to sign in to do that
Don't have an account?
Lorant Dobrondi
Problems reading CSV attachment in Inbound Email Handler
Hello,
I have some issues while reading a CSV attachment of an inbound email.
I want Salesforce to listen to an email address, and process all inbound emails coming to that email address.
We will send CSV files as attachments, and I want to load that data into Leads and custom objects, however I'm having difficulties reading the CSV file.
I implemented the above code in an Inbound Email Handler class, where nothing happens...The exact same code runs fine if I read the CSV file from a Salesforce Document/File.
I am using Marty Chang's CSV Reader implementation which can be found here: LINK (http://frombelvideres4thfloor.blogspot.com/2010/10/ietf-rfc-4180-compliant-csv-reader-for.html)
What can be the issue with the Email Handler?
I have some issues while reading a CSV attachment of an inbound email.
I want Salesforce to listen to an email address, and process all inbound emails coming to that email address.
We will send CSV files as attachments, and I want to load that data into Leads and custom objects, however I'm having difficulties reading the CSV file.
if(email.textAttachments != null) { for (Messaging.Inboundemail.TextAttachment tAttachment : email.textAttachments) { if (tAttachment.fileName == 'Leads-import.csv') { //process text attachment with CSV parser Blob csvBlob = Blob.valueOf(tAttachment.body); // Convert your csv file into a list of CSV fields List<List<String>> csvRecords = CSVReader.readIETFRFC4180CSVFile(csvBlob); import(csvRecords, 'Lead'); } } }
I implemented the above code in an Inbound Email Handler class, where nothing happens...The exact same code runs fine if I read the CSV file from a Salesforce Document/File.
I am using Marty Chang's CSV Reader implementation which can be found here: LINK (http://frombelvideres4thfloor.blogspot.com/2010/10/ietf-rfc-4180-compliant-csv-reader-for.html)
What can be the issue with the Email Handler?