Andris Reinman
Andris Reinman
CDCloudflare Developers
Created by Sven on 2/21/2024 in #workers-help
Getting the body from a email-worker.
The postal-mime module API has changed, and it now includes built-in support for Cloudflare Email Workers. You can read about using it to parse emails from here: https://docs.emailengine.app/how-to-parse-emails-with-cloudflare-email-workers/
import PostalMime from 'postal-mime';
export default {
async email(message, env, ctx) {
const parser = new PostalMime();
const email = await parser.parse(message.raw);
// ... do something with the parsed email
}
};
import PostalMime from 'postal-mime';
export default {
async email(message, env, ctx) {
const parser = new PostalMime();
const email = await parser.parse(message.raw);
// ... do something with the parsed email
}
};
18 replies