You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when I parse an email that contains an attachment, the content property is undefined (while instead, it works correctly if the email has no attachment). My code is like this (it's actually split between two files, but it gives you an idea):
constparsedEmail=parse(email)console.log("Email's content: ",parsedEmailObject.content);if(parsedEmailObject.content!=null){//Extract email's body only if it actually existsconstbodyAsHTML=newTextDecoder().decode(objectToUInt8array(parsedEmailObject.content));console.log("HTML body: ",bodyAsHTML);// TODO: what if email isn't in HTML format? How do I detect this? Probably it is enough to inspect the 'contentType' parameterconstbodyAsText=extractEmailBodyFromHTML(bodyAsHTML);console.log("Body: ",bodyAsText);domEmail.body(bodyAsText);}elsedomEmail.body(" ");
If the email doesn't have attachmments, this code correctly extracts the email's body, while if it has attachments, it fails due to parsedEmailObject.content being undefined. My questions are:
How should I extract the email's body when the email has one or more attachments?
How do I extract the attachments?
Thank you for your help,
GTP
The text was updated successfully, but these errors were encountered:
Update: by looking at the source I saw that there is a finalize() method that should emit the body, I tried calling it after the parse() method but the result didn't change.
Greetings,
I noticed that when I parse an email that contains an attachment, the
content
property isundefined
(while instead, it works correctly if the email has no attachment). My code is like this (it's actually split between two files, but it gives you an idea):If the email doesn't have attachmments, this code correctly extracts the email's body, while if it has attachments, it fails due to
parsedEmailObject.content
being undefined. My questions are:Thank you for your help,
GTP
The text was updated successfully, but these errors were encountered: