Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app
- +/public
- +/css
- style.css
- image.png
- +/src
- +/client
- +/server
- +/templates
- +/verify
- html.pug
- text.pug
- +server.js
- require('dotenv').config({path: __dirname + "/../../.env"});
- const path = require('path');
- const express = require('express');
- const app = express();
- const port = 8080;
- const cors = require('cors');
- const bodyParser = require('body-parser');
- app.use(cors());
- app.use(bodyParser.urlencoded({extended: true }));
- app.use(bodyParser.json());
- app.set('view engine', 'pug');
- app.use(express.static(path.join(__dirname, '../../', 'public')));
- const nodemailer = require('nodemailer');
- const Email = require('email-templates');
- const transporter = nodemailer.createTransport({
- address: 'smtp.gmail.com',
- host: 'smtp.gmail.com',
- port: 465,
- secure: true,
- service: 'gmail',
- auth: {
- user: process.env.SENDER_EMAIL,
- pass: process.env.SENDER_PASS
- },
- authentication: 'plain',
- enable_stattls_auto: true
- });
- const email = new Email({
- transport: transporter,
- views: {
- root: './templates'
- },
- send: true,
- preview: false
- });
- email.send({
- template: 'verify',
- message: {
- from: process.env.SENDER_EMAIL,
- to: '*email*',
- subject: 'Activise - Email Verification',
- },
- locals: {}
- })
- .then(() => console.log('EMAIL SENT'))
- .catch(err => console.log("ERROR: " + err));
- app.listen(port, () => console.log('Server listening for requests on port 8080!'))
- doctype html
- html
- head
- title=title
- link(rel="stylesheet", href="/css/style.css" type="text/css")
- body
- .email-text
- img(src="/image.png", alt="Application logo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement