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

Inbound Email Headers



    We currently use Inbound Email services for our SF org, integrating various Outlook inboxes into SF as a custom object. I am having some difficulty collecting the inbound email headers from the email itself. If it helps, I am looking for a way to read the created date/time of email, which is contained in "email.headers", but I am getting errors try to capture and then display this information in SF. Any assistance or sample code will greatly be appreciated.



whats the issue you are facing ? unable to grab the date or any date formatting issues?


Did you get a chance to go through the following KB:

This explains how to access the header information from InboundEmail.header in Apex code

Hope this is helpful!

Link for reference:

Ella Christina Lopez 1Ella Christina Lopez 1
I am having the same issue. It always says either "Variable does not exist"...So I inserted some code used for testing just to start me off but I really don't have much clue.

global class EmailtoAttendance implements Messaging.InboundEmailHandler {
      global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
          Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
          Attendance__c Attendance = new Attendance__c ();
          Attendance.Success_Agent_Name__c = email.fromName.substring(0,email.fromName.indexOf(' '));
         Messaging.InboundEmail.Header header= new Messaging.InboundEmail.Header();
         email.headers=new Messaging.InboundEmail.Header[1];'Date'; header.value='';