I have a js file that sends emails like this:
Email.send ({
Host: "smtp.gmail.com",
Username: "mymail",
Password: "mypassword",
To: 'mymail',
From: `$ {email}`,
Subject: `Site, $ {name} invite a message`,
Body: `$ {body} <br> $ {tel}`,
})
.then (function (message) {
alert ("mail sent successfully")
});
But my password is hardcode if someone inspect the code, can see it, how can I hide it?
Just don't do it this way as far as this code is not running on node.js server-side.
Sending emails should be done on the server-side, dunno which language you are using so I'm going to paste below a list of useful classes from various frameworks/languages.
And remember, never ever store passwords in plain text.