Guest User

Untitled

a guest
Jun 28th, 2018
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. Server response: 550 5.7.1 Unauthenticated email from guest.com is not
  2. accepted due to domain's 5.7.1 DMARC policy. Please contact the administrator
  3. of guest.com domain if 5.7.1 this was a legitimate mail. Please visit 5.7.1
  4. https://support.google.com/mail/answer/2451690 to learn about the 5.7.1 DMARC
  5. initiative. s12-v6si3013316qtg.362 - gsmtp
  6.  
  7. const express = require('express');
  8. const nodemailer = require('nodemailer');
  9. const path = require('path');
  10. const bodyParser = require('body-parser');
  11.  
  12.  
  13. const app = express();
  14.  
  15. const port = 3000;
  16.  
  17. app.use(bodyParser.json());
  18.  
  19. app.use(express.static(path.join(__dirname, 'dist')));
  20.  
  21. app.post('/email', (req, res) => {
  22. let transporter = nodemailer.createTransport({
  23. host: 'smtp.mailgun.org',
  24. port: 587,
  25. secure: false, // true for 465, false for other ports
  26. auth: {
  27. user: 'postmaster@sandboxc8f2ecf64f364ca6ad740e658485c557.mailgun.org',
  28. pass: 'my API key here'
  29. },
  30. tls: {
  31. rejectUnauthorized: false
  32. }
  33. });
  34.  
  35. // setup email data with unicode symbols
  36. let mailOptions = {
  37. from: req.body.from, // sender address
  38. to: 'cu0ngpitt@gmail.com', // list of receivers
  39. subject: 'Someone wrote you from your Online Resume!', // Subject line
  40. text: req.body.messge, // plain text body
  41. };
  42.  
  43. // send mail with defined transport object
  44. transporter.sendMail(mailOptions, (error, info) => {
  45. if (error) {
  46. return console.log(error);
  47. }
  48. console.log('Message sent: %s', info.messageId);
  49. console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
  50. });
  51. });
  52.  
  53. app.get('/', (req, res) => {
  54. res.send('Hello world');
  55. });
  56.  
  57. app.listen(port, () => {
  58. console.log('Server running on port ' + port);
  59. })
Add Comment
Please, Sign In to add comment