-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
40 lines (35 loc) · 863 Bytes
/
server.js
File metadata and controls
40 lines (35 loc) · 863 Bytes
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
const express = require('express');
const router = express.Router();
const cors = require('cors');
const nodemailer = require('nodemailer');
const app = express();
app.use(cors());
app.use('/', router);
app.listen(3000, () => console.log('Server Running'));
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'krystlemm89@gmail.com',
pass: 'bkkgtgyobeklaaao',
},
});
transporter.verify((error) => {
if (error) {
console.log(error);
} else {
console.log('Ready to Send');
}
});
const mailOptions = {
from: 'krystlemm89@gmail.com',
to: 'mitchell.krystle2@gmail.com',
subject: 'Contact Form Submission',
text: 'This is a test',
};
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
console.log(error);
} else {
console.log('Email Sent' + info.response);
}
});