feat: Enhance Nodemailer transport with attachment support and raw message streaming

This commit is contained in:
Siwat Sirichai 2025-08-19 02:09:10 +07:00
parent a89e780165
commit 26d11289ea
2 changed files with 47 additions and 5 deletions

View file

@ -16,7 +16,7 @@ async function nodemailerTransportExample() {
apiKey: 'cebc9a7f-4e0c-4fda-9dd0-85f48c02800c',
port: 80,
secure: false, // Set to true for wss://
debug: false
debug: true
});
// Create Nodemailer transporter
@ -51,7 +51,15 @@ async function nodemailerTransportExample() {
<li>Nodemailer compatibility</li>
<li>WebSocket-based SMTP relay</li>
</ul>
`
<p><strong>This email includes a test attachment!</strong></p>
`,
attachments: [
{
filename: 'test-attachment.txt',
content: Buffer.from(`This is a test attachment generated at ${new Date().toISOString()}\n\nRandom data: ${Math.random()}\nUUID: ${Date.now()}-${Math.random().toString(36).substr(2, 9)}\n\nFeatures tested:\n- File attachment support\n- Binary content handling\n- MIME multipart encoding\n- WebSocket SMTP transport\n\nEnd of test file.`, 'utf8'),
contentType: 'text/plain'
}
]
});
console.log('Email sent successfully!');