Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Server response: 550 5.7.1 Unauthenticated email from guest.com is not
- accepted due to domain's 5.7.1 DMARC policy. Please contact the administrator
- of guest.com domain if 5.7.1 this was a legitimate mail. Please visit 5.7.1
- https://support.google.com/mail/answer/2451690 to learn about the 5.7.1 DMARC
- initiative. s12-v6si3013316qtg.362 - gsmtp
- const express = require('express');
- const nodemailer = require('nodemailer');
- const path = require('path');
- const bodyParser = require('body-parser');
- const app = express();
- const port = 3000;
- app.use(bodyParser.json());
- app.use(express.static(path.join(__dirname, 'dist')));
- app.post('/email', (req, res) => {
- let transporter = nodemailer.createTransport({
- host: 'smtp.mailgun.org',
- port: 587,
- secure: false, // true for 465, false for other ports
- auth: {
- user: 'postmaster@sandboxc8f2ecf64f364ca6ad740e658485c557.mailgun.org',
- pass: 'my API key here'
- },
- tls: {
- rejectUnauthorized: false
- }
- });
- // setup email data with unicode symbols
- let mailOptions = {
- from: req.body.from, // sender address
- to: 'cu0ngpitt@gmail.com', // list of receivers
- subject: 'Someone wrote you from your Online Resume!', // Subject line
- text: req.body.messge, // plain text body
- };
- // send mail with defined transport object
- transporter.sendMail(mailOptions, (error, info) => {
- if (error) {
- return console.log(error);
- }
- console.log('Message sent: %s', info.messageId);
- console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
- });
- });
- app.get('/', (req, res) => {
- res.send('Hello world');
- });
- app.listen(port, () => {
- console.log('Server running on port ' + port);
- })
Add Comment
Please, Sign In to add comment