I'm trying to setup ZOHO mail with Nodemailer. The mail is configured correctly and I'm using following code to send the mail:
var transporter = nodemailer.createTransport({
host: 'smtp.zoho.eu',
port: 465,
secure: true, //ssl
auth: {
user:'[email protected]',
pass:'supersecretpassword'
}
});
sendMail = function(req,res) {
var data = req.body;
transporter.sendMail({
from: data.contactEmail,
to: '[email protected]',
subject: data.contactSubject,
text: data.contactMsg
});
res.json(data);
};
I contacted official support but no response so far. Maybe someone here has experience with it. The problem is that when using these settings I get a message that relaying is disallowed for the address in variable 'data.contactEmail'. When I change the from e-mail also to [email protected] I do receive the e-mail but of course I do not know who sent it and can't reply to it.
Anyone who knows how to make the 'from' address work with unknown addresses? Like [email protected] ?
You should make an email account for your server : [email protected]
When you are going to relay the mail craft a custom MAILBODY containing the subject and message
var MAILBODY ='\n[suject]:\n'+data.contactSubject+'\n\n[msg]:\n'+data.contactMsg;
So you will be sending the original contactEmail as the subject of the mail and using the mail's text (body) to se the message subject and the message content.
transporter.sendMail({
from: '[email protected]',
to: '[email protected]',
subject: data.contactEmail,
text: MAILBODY
});
Example bot account will be able of sending the email to yourself with all the details you really need. (because you control that email account / your domain)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With