Search code examples
twiliotwilio-apitwilio-functions

How to send emails in Twilio Functions without SendGrid?


I know we can use SendGrid and there are examples provided but SendGrid is awful and everything goes to spam with the non-dedicated IP accounts (yes, even after enabling DKIM and all that other stuff). All the free IPs are blacklisted and SendGrid support won't remove them or give me non-blacklisted IPs.

Is there any other way to send emails without using SendGrid using Twilio Functions? Can I somehow use NodeMailer and set it up with Gmail? That would be the ideal solution.


Solution

  • Twilio developer evangelist here.

    With Twilio Functions you can install any npm module you like as long as it doesn't require native extensions (look out for anything that depends on node-gyp for example).

    As NodeMailer has no dependencies, you can absolutely use it. Just head to the Configuration section in your Twilio console and add NodeMailer as a dependency. You can then require it in any of your Twilio Functions and use it from there.

    Let me know if that helps at all.