-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnodemailer.js
31 lines (26 loc) · 858 Bytes
/
nodemailer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// require patch first
require('../../lib/index');
// then nodemailer
const nodemailer = require('nodemailer');
async function sendTestMail() {
const testAccount = await nodemailer.createTestAccount();
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
secure: false,
auth: {
user: testAccount.user,
pass: testAccount.pass,
},
});
const info = await transporter.sendMail({
from: '"Foo" <[email protected]>',
to: '[email protected]',
subject: 'It works!!!',
text: 'Successfully patched nodemailer!',
html: 'Successfully patched <b>nodemailer</b>!',
});
console.log('Message sent: %s', info.messageId);
console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
}
sendTestMail();