export default {
async email(message, env, ctx) {
console.log(message.plainBody);
const webhookUrl = 'https://yoururl.com';
const webhookPayload = JSON.stringify({
subject: message.headers.get('subject'),
from: message.from,
to: message.to,
body: message.content
});
try {
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: webhookPayload,
});
} catch (error) {
console.error('Error sending webhook request:', error);
}
}
}