-
Notifications
You must be signed in to change notification settings - Fork 15
Help needed to send attachments #12
Copy link
Copy link
Open
Description
I am looking to send a file as attachment and some body text using smtp-client. Can someone share the what parameters to be sent to smtp.data() method. I am not sure about what will be values of header & body.
try {
await smtp.connect();
await smtp.greet({hostname: SMTP_SELFHOSTNAME});
await smtp.secure();
await smtp.greet({hostname: SMTP_SELFHOSTNAME});
await smtp.authPlain({username: SMTP_USERNAME, password: SMTP_PASSWORD});
await smtp.mail({from: SMTP_FROMADDRESS});
await smtp.rcpt({to: destinationEmail});
await smtp.data(header + body);
await smtp.quit();
} catch (err) {
console.log('Error sending email:', err);
}
Any help will be much appreciated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels