Email worker: EmailEvent parsing body?

Hi,

I’d like to create an email worker that receives the email, parse its body and publish it using a rest API, for instance to re-implement the “mail to topic” feature of discourse.

the EmailMessage seems to offer only a raw content, is there an example to parse the body, eg check the html part, of if there is an attachment or anything more high level than the raw stream?

1 Like

the documentation:

https://developers.cloudflare.com/workers/runtime-apis/email-event/

Did you have any success with this?

There’s an example of parsing the email body here, by an employee, using the postal-mime library: email_worker_parser/src/index.js at main · edevil/email_worker_parser · GitHub