forked from present42/sschub-express
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail.js
More file actions
52 lines (46 loc) · 1.52 KB
/
Copy pathemail.js
File metadata and controls
52 lines (46 loc) · 1.52 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// import nodeoutlook from 'nodejs-nodemailer-outlook'
// console.log(nodeoutlook);
// nodeoutlook.sendEmail({
// auth: {
// user: 'messageboard.sschub@outlook.com',
// pass: 'sschub*messageboard1'
// },
// from: 'sender@outlook.com',
// to: 'hkimar@connect.ust.hk',
// subject: 'hi! there',
// html: '<b>This is bold text</b>',
// text: 'This is text version!',
// onError: (e) => console.log(e),
// onSuccess: (i) => console.log(i)
// });
import nodemailer from 'nodemailer';
var transporter = nodemailer.createTransport({
// host: "smtp-mail.outlook.com", // hostname
// secure: true,
// port: 587, // port for secure SMTP
// // tls: {
// // ciphers: 'SSLv3'
// // },
// auth: {
// user: 'messageboard.sschub@outlook.com',
// pass: 'sschub*messageboard1'
// }
service: 'hotmail',
auth: {
user: 'messageboard.sschub@outlook.com',
pass: 'sschub*messageboard1'
}
});
var mailOptions = {
from: '"Our Code World " <mymail@outlook.com>', // sender address (who sends)
to: 'hyeonjae42@gmail.com, hkimar@connect.ust.hk', // list of receivers (who receives)
subject: 'Hello ', // Subject line
text: 'Hello world ', // plaintext body
html: '<b>Hello world </b><br> This is the first email sent with Nodemailer in Node.js' // html body
};
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
return console.log(error);
}
console.log('Message sent: ' + info.response);
});