Hi,
I'm also hosting a mail script on a shared hosting environment with shell
access.
Like you, I didn't want to code email adresses and passwords into the file.
To do that, I use prompt (https://npmjs.org/package/prompt). My code looks
like this:
var prompt = require("prompt"),
nodemailer = require("nodemailer"),
password = "",
mailOptions = {
from: "",
to: "",
subject: "Email from website",
html: "<b>html body</b>"
};
prompt.start();
// get input from stdin
prompt.get(["from", "to", "password"], function (err, result) {
mailOptions.from = result.from;
mailoptions.to = results.to;
password = result.password;
// expressjs
app.listen(7331);
console.log('Listening on port 7331');
});
// more code [..]
sendMail();
So now when I start the process Prompt asks me for the stuff:
$ node app.js
prompt: from: [email protected]
prompt: to: [email protected]
prompt: password: thesecretpassword
If you want better security, you could keep the username and password
> only in the memory of a long running daemon process. That way, at
> least someone may need to read the virual memory of that process in
> order to get the password, not that this is incredibly hard either.
>
Hm. Is it really so easy to get the password out of a node process which is
not owned by your user? I hope not! :-)
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en