Itegrate email(created in cpanel) SMTP config

i integrated my email created in Cpanel but i got
config

var username = 'noreply@server.com';
 var password = 'passwprd';
 var server = 'mail.server.com';
var port = '587';

 process.env.MAIL_URL = 'smtp://' +
     encodeURIComponent(username) + ':' +
     encodeURIComponent(password) + '@' +
     encodeURIComponent(server) + ':' + port;
 console.log("message",process.env.MAIL_URL);

ERROR

0|| { Error: self signed certificate
0||     at TLSSocket.<anonymous> (_tls_wrap.js:1116:38)
0||     at emitNone (events.js:106:13)
0||     at TLSSocket.emit (events.js:208:7)
0||     at TLSSocket._finishInit (_tls_wrap.js:643:8)
0||     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'ESOCKET', command: 'CONN' }

Since your SMTP server is using an invalid certificate, you will need to tell Mail to ignore TLS by adding ?ignoreTLS=true to your connection string like so:

 process.env.MAIL_URL = 'smtp://' +
     encodeURIComponent(username) + ':' +
     encodeURIComponent(password) + '@' +
     encodeURIComponent(server) + ':' + port + 
     '?ignoreTLS=true;

(You may also need to add secure=false)

This works because Meteor uses Nodemailer under the hood, and Nodemailer will parse connection options from the query-string of the connection url

0|x| ====== BEGIN MAIL #0 ======
0|x| (Mail not sent; to enable sending, set the MAIL_URL environment variable.)
0|x| Content-Type: text/plain
0|x| From: noreply@xxx.com
0|x| To: xxxx@gmail.com
0|x| Subject: test mail
0|x| Message-ID: 414592dc-6cd7-fe6f-6ba1-9d27a80a52bf@xxx.com
0|x| Content-Transfer-Encoding: 7bit
0|x| Date: Thu, 28 Mar 2019 01:27:29 +0000
0|x| MIME-Version: 1.0
0|x|
0|x| test content
0|x|
0|x| ====== END MAIL #0 ======

Where are you setting process.env.MAIL_URL?

yes like you told me

process.env.MAIL_URL = 'smtp://' +
    encodeURIComponent(username) + ':' +
    encodeURIComponent(password) + '@' +
    encodeURIComponent(server) + ':' + port+'?ignoreTLS=true';

What location in your code?
Environment variables are normally set in the environment and not in code.
Meteor is nice and delays the reading of that environment variable until the first time that you try to send an email. This means that the order in which your code runs is important.

The error in the original post shows an attempt to send the email.

The error in the second post is the behaviour when MAIL_URL is not set prior to calling send

Which implies that either the code that sets MAIL_URL is not running before the send call, is throwing an error, or it is not running at all.
Did anything else change between the first and second post?

no just i added
+’?ignoreTLS=true’;

and the MAIL_URL is in the first

Maybe try it without the encodeURIComponent?

If this approach doesn’t work you may need to use an SMTP server with a valid SSL certificate

it works by adding this line

process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;