feat: Update SMTP transport to use API key for authentication and improve error handling

This commit is contained in:
Siwat Sirichai 2025-08-19 01:57:21 +07:00
parent e22b064738
commit efb7dc43b7
4 changed files with 169 additions and 331 deletions

View file

@ -13,12 +13,10 @@ async function nodemailerTransportExample() {
// Create the WebSocket transport
const transport = createTransport({
host: '192.168.0.62',
apiKey: 'cebc9a7f-4e0c-4fda-9dd0-85f48c02800c',
port: 80,
secure: false, // Set to true for wss://
auth: {
user: 'cebc9a7f-4e0c-4fda-9dd0-85f48c02800c' // Your SMTP relay API key
},
debug: true
debug: false
});
// Create Nodemailer transporter
@ -39,8 +37,8 @@ async function nodemailerTransportExample() {
console.log('Sending test email...');
const info = await transporter.sendMail({
from: 'sender@example.com',
to: 'recipient@example.com',
from: 'cudconnex@satitm.chula.ac.th',
to: 'siwat.s@chula.ac.th',
subject: 'Test Email via SMTP WebSocket',
text: 'This email was sent using the SMTP WebSocket transport!',
html: `