Hi,
I am reading email using imap
Mail.headers(“htmlbody”).toString
When i read email body through above code, “&” gets converted to “&”
Any resolution?
Hi,
I am reading email using imap
Mail.headers(“htmlbody”).toString
When i read email body through above code, “&” gets converted to “&”
Any resolution?
Hi @garimavarshney9,
Are you purposely reading html body.
If not please try Mail.body so that it returns string which can be used.
Thanks
The ampersand sign &
is encoded in html as &
since you are extracting the actual html and turning it into a string, if you see &
the literal html string being returned is correct at &
Here is my favorite website for all things html that explains it a bit: HTML Entities
I need only the string from email body. Bur using imap, i am only able get html body since mail.body returns empty string. Any other way to get text from email without html
Hey @garimavarshney9,
Try Mail.headers(“PlainText”)
This will give you the string from the email body.
Thanks
I cannot see plain Text listed in Headers for my mailmessage.
Is getting the body using mail.headers(“HTMLBody”) and then replacing the characters and HTML using regex and string manipulation the only way left?