Skip to content

Instantly share code, notes, and snippets.

@amitbend
Last active October 17, 2022 12:32
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amitbend/231cffcf86576432b55f61620db23b58 to your computer and use it in GitHub Desktop.
Save amitbend/231cffcf86576432b55f61620db23b58 to your computer and use it in GitHub Desktop.
nodemailer with Zoho
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
host: 'smtp.zoho.com',
port: 465,
secure: true, //ssl
auth: {
user: 'youremail@amitbend.com',
pass: 'yourpassword'
}
});
function sendMail(err, env, botname) {
let mailOptions = {
from: '"My service name" <youremail@amitbend.com>', // sender address (who sends)
to: 'me@amitbend.com', // list of receivers (who receives)
subject: `subject`, // Subject line
html: `<b>Time:</b> <p>email body</p>` // html body
};
// send mail with defined transport object
return new Promise(
(resolve, reject) => {
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.error(`couldn't send mail ${error}`);
reject(error)
} else {
console.log('Message sent: ' + info.response);
resolve(info.response)
}
});
})
}
@elemensisht
Copy link

Can I send mail using Client Id & client Secret using access token for Zoho?

@valeporti
Copy link

Hello @amitbend, did you managed to do it with a zoho free acoount?

@amitbend
Copy link
Author

@valeporti, yes I did - A while ago as you can see but yes

@valeporti
Copy link

@valeporti, yes I did - A while ago as you can see but yes

thanks!

@lincolnaleixo
Copy link

doesn't work, get 535 authentication failed. Already reset password but the error persists...

@rauleite
Copy link

rauleite commented Oct 24, 2019

Thanks! Worked well for me - free zoho account.

@heshamelmasry77
Copy link

@lincolnaleixo did you find any solution ?

@lincolnaleixo
Copy link

lincolnaleixo commented Nov 8, 2019

@heshamelmasry77 No I didn't, I switched to gmail

@heshamelmasry77
Copy link

@heshamelmasry77 No I didn't, I switched to gmail

I found a solution here : https://gist.github.com/heshamelmasry77/5b03564682861da14de0770208813242

@lincolnaleixo
Copy link

thanks will take a look and try to use in my next projects

@mayeaux
Copy link

mayeaux commented Jan 18, 2020

Anyone able to verify if that fix works?

@valeporti
Copy link

It worked for me, the solution of @amitbend. No further fixes. Just a detail for the host. I had to change the ".com" to ".eu" because my zoho host is located in Europe

@kunalchikte
Copy link

Yes, Thank You @valeporti, I had stuck on this issue for a long time. Just had to change it from ".com" to ".in"

@waki285
Copy link

waki285 commented Feb 19, 2022

Thank you, @valeporti .
I'm Japanese, I resolved the problem. for 'smtp.zoho.com' change to 'smtp.zoho.jp'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment