I had set up the mailing with nodemailer using mailgun few months back, and that was working fine but I had got few recurring issues, that's why I have switched the implementation from SMTP to API, and I found it quite simpler than that of the SMTP as no extra library need to be used, apart from the request client axios.
Link to snippets: https://gist.github.com/mondyfy/ea8bf...
Link to blog: https://dev.to/sandipbasnet/sending-e...