Closed soonoo27 closed 4 years ago
If you want to send multiple email, just don't close/quit the conection.
await s.connect();
await s.greet({hostname: 'localhost'}); // runs EHLO command or HELO as a fallback
await s.authPlain({username: '*****', password: '*****'}); // authenticates a user
await s.mail({from: '*****@gmail.com'}); // runs MAIL FROM command
await s.rcpt({to: '*****@gmail.com'}); // runs RCPT TO command (run this multiple times to add more recii)
await s.data('Subject: The Next Meeting\r\n\r\nmail source'); // runs DATA command and streams email source
// Second email
await s.mail({from: '*****@gmail.com'}); // runs MAIL FROM command
await s.rcpt({to: '*****@gmail.com'}); // runs RCPT TO command (run this multiple times to add more recii)
await s.data('mail source'); // runs DATA command and streams email source
await s.quit(); // runs QUIT command
or reconstruct the client if you need to send again after a while.
Is there anything wrong with my approach?