Akathian Santhakumar
Akathian Santhakumar

Reputation: 21

Getting "Gmail couldn't verify that mydomain.com actually sent this message (and not a spammer)" message when sending emails with nodemailer

I'm trying to send emails using nodemailer using

  let transporter = nodemailer.createTransport({
    host: 'mail.hover.com',
    port: 465,
    secure: true, // true for 465, false for other ports
    auth: {
      user: '[email protected]', 
      pass: 'password', 
    },
  });

  // send mail with defined transport object
  let info = await transporter.sendMail({
    from: {
      name: 'My name',
      address: '[email protected]',
    }, // sender address
    replyTo: '[email protected]',
    to: '[email protected]', // list of receivers
    subject: 'Hello ✔', // Subject line
    text: 'Hello world?', // plain text body
    html: '<b>Hello world?</b>', // html body
  });

This sends the email as intended, but Gmail gives a warning that "Gmail couldn't verify that mydomain.com actually sent this message (and not a spammer)". I was wondering if there was a way to send the email in such a way that Gmail would know that [email protected] actually sent the email.

Thanks!

Upvotes: 0

Views: 1174

Answers (1)

Akathian Santhakumar
Akathian Santhakumar

Reputation: 21

Found a solution. I essentially allowed emails from my to be sent from my custom email. I followed the guide here: https://support.google.com/mail/answer/22370?hl=en.

  1. Open Gmail.

  2. In the top right, click Settings Settings and then See all settings.

  3. Click the Accounts and import or Accounts tab.

  4. In the "Send mail as" section, click Add another email address.

  5. Enter your name and the address you want to send from (my custom email).

  6. Click Next Step and then Send verification.

  7. For the SMTP server, I put mail.hover.com (since that's what I'm using)

  8. Sign in to my custom domain and click the verification link

  9. Send Email using NodeMailer

    let transporter = nodemailer.createTransport({
        host: 'smtp.gmail.com',
        port: 465,
        secure: true,
        auth: {
          user: '[email protected]', 
          pass: 'password', 
        },
      });
    let info = await transporter.sendMail({
        from: {
          name: 'My name',
          address: '[email protected]',
        },
        to: '[email protected]', 
        subject: 'Hello ✔', 
        text: 'Hello world?', 
        html: '<b>Hello world?</b>',
      });
    

Upvotes: 2

Related Questions