-
Currently with the Email Workers, an email message is defined with With the get started and the following script, every data read are an export default {
/**
* @param {{raw: ReadableStream}} message
*/
async email(message, env, ctx) {
const reader = message.raw.getReader();
const read = await reader.read();
if (typeof read == 'object') {
console.log(`object type: ${read.value.constructor.name}`)
}
else {
console.log(`type: ${typeof read}`)
}
}
} Example of a log output from the Worker. {
"outcome": "ok",
"scriptName": "email-test",
"diagnosticsChannelEvents": [],
"exceptions": [],
"logs": [
{
"message": [
"object type: Uint8Array"
],
"level": "log",
"timestamp": 1703151398815
}
],
"eventTimestamp": 1703151398801,
"event": {
"rawSize": 11889,
"rcptTo": "john.doe@example.com",
"mailFrom": "from@example.com"
},
"id": 0
} All types are accepted or the stream is only a |
Beta Was this translation helpful? Give feedback.
Answered by
jasnell
Dec 21, 2023
Replies: 1 comment
-
In this case, the value should always be a |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
niquenen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this case, the value should always be a
Uint8Array
.