I'm using nodemailer to send emails from my web app. I already send emails from one gmail account to another gmail account using "service: 'gmail'".
const nodemailer = require("nodemailer");
const promisify = require("es6-promisify");
const transport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: "my gmail",
pass: "my password"
}
});
exports.send = async options => {
const mailOptions = {
from: options.email,
to: 'adikosh10@gmail.com',
subject: options.subject,
html: options.text,
text: options.text
};
const sendMail = promisify(transport.sendMail, transport);
return sendMail(mailOptions);
};
The code above works but I can't make it work for outlook accounts. Meaning it dose not work if I email to an outlook or hotmail account.
Moreover, I don't know how to register multiple services so I can send email to any email service (hotmail, outlook, gmail...) and not only gmail.
How can I do it ? Please help if you can.
Thank you, Adi