Send Nodemailer e-mail with Namecheap email
Asked Answered
T

3

6

I have been successful connecting a Gmail account with Xoauth, but I recently acquired a Namecheap privateemail account and can't for the life of me figure out how to set it up. This is the code that I have:

var smtp = nodemailer.createTransport({
    host: 'mail.privateemail.com',
    port: 25,
    auth: {
        user: '[email protected]',
        pass: 'mypassword'
    }
});

I saw this question and tried all the other port numbers.

Trellis answered 29/8, 2016 at 0:20 Comment(0)
B
9

It may be secured connection in that case the port should be 465

465 port for SSL, 25 or 26 for TLS/STARTTLS

Bluebottle answered 29/8, 2016 at 3:15 Comment(0)
F
0

According to Namecheap support website as of Nov 7, 2017 - configuration to send messages through Namecheap Private Email server:

Outgoing server (SMTP): port 465 for SSL, port 587 for TLS/STARTTLS

Outgoing server authentication should be switched on,
SPA (secure password authentication) must be disabled.
Fiddlefaddle answered 7/11, 2017 at 15:13 Comment(2)
Oh and, outgoing server name to use: mail.privateemail.com. BTW, TLS/STARTTLS is secure.Fiddlefaddle
If the flag secure is set True, then you need to use 465, otherwise you get error Error: 8541117952:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:332:Heterochromous
T
0

Instructions for sending emails through Nodemailer with a Namecheap private email.

These instructions assume you have created your mailbox through Namecheap and have configured your DNS settings through your DNS provider.

  1. Create environment variables:
  • host ("mail.privateemail.com")
  • user ("your namecheap email address")
  • pass ("the associated password to this email address").
  • sender email ("The email address you would like to send the email from")
  1. Create your Nodemailer transporter:

     const transporter = nodemailer.createTransport({
       host: host,
       port: 465,
       secure: true, // use false for STARTTLS; true for SSL on port 465
       auth: {
         user: user,
         pass: pass
       },
       logger: true, // Enable logging
       debug: true // Enable debug output
     });
    
  2. Sending an email from your email to your inbox:

     const mailOptions = {
       from: sender_email, // Sender's email address.
       to: sender_email, // Recipient's name and email address.
       subject: "New Email", // Subject line.
       text: message // Plaintext body.
     };
    
     // Send email and log the response.
     const response = await transporter.sendMail(mailOptions);
    
Tier answered 8/8, 2024 at 21:26 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.