Ask coding questions

← Back to all posts
please help
frostedbutton75 (52)

Please help with this project about NodeMailer. I would like it so when you run it it will send u an email.
comment and say you want to help

Answered by ruiwenge2 (582) [earned 5 cycles]
View Answer
ruiwenge2 (582)

you can use this code:

var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'EMAIL',
    pass: 'PASSWORD'

var mailOptions = {
  from: 'EMAIL',
  to: 'RECEIVER',
  subject: 'subject',
  text: 'text'

transporter.sendMail(mailOptions, function(error, info){
  if (error) {
  } else {
    console.log('Email sent: ' + info.response);

replace EMAIL with your email, replace RECEIVER with the receiver's email, and replace PASSWORD with your gmail password. hope this helps!

ruiwenge2 (582)

@frostedbutton75 please mark the answer as correct if it helped!