Martin
Martin
CDCloudflare Developers
Created by Martin on 9/17/2023 in #workers-help
Email Body Extraction
Can I extract the body of a message from an email that has been routed to a worker? I tried extracting the raw message from EmailEvent but there was everything else except the body.
export default {
async email(message, env, ctx) {
const reader = message.raw.getReader();
const { value, done } = await reader.read();
const emailContent = new TextDecoder().decode(value);
}
}
export default {
async email(message, env, ctx) {
const reader = message.raw.getReader();
const { value, done } = await reader.read();
const emailContent = new TextDecoder().decode(value);
}
}
2 replies