We’re using inbound parse to handle messages inside SendGrid. Now we want to work with replying to messages, for which we need to extract the Message-ID from the email.
How do we extract the Message-ID from an email that goes via the inbound parsing? As I do not see it in the request headers.
Hello @wooyah,
The Message-ID should be in the headers. Could you please provide a bit more detail so I can try and reproduce?
With Best Regards,
Elmer
@wooyah
I found it better to use the following...
var MailParser = require("mailparser").MailParser;
var mailparser = new MailParser();
mailparser.on("end", function(mail_object){
log(util.inspect(mail_object));
});
mailparser.write(req.body.email);
mailparser.end();
This requires checking the Inbound Parse setting 'POST the raw, full MIME message'.
You'll find the mail_object has what you need.
Thanks for helping out @jerryongit!
I've just edited your comment for readability.
Thanks @jerryongit ,
Your code was really helpful.
I set to use busboy to catch required data from Headers, and now have no problem to get. :)
Most helpful comment
@wooyah
I found it better to use the following...
This requires checking the Inbound Parse setting 'POST the raw, full MIME message'.
You'll find the mail_object has what you need.