avatarDavid Fekke

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1672

Abstract

odemailer <span class="hljs-attr">--save</span></pre></div><p id="2def">To send out our “Integration Test Email” we can write a simple program that creates a network connection to an SMTP server.</p> <figure id="6a8e"> <div> <div>

            <iframe class="gist-iframe" src="/gist/davidfekke/8f3a3d94a1b9dd4595f23954a34a2e12.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="4bc5">If you are going to test sending email, you might want to start by using a fake SMTP service. <a href="https://mailtrap.io/">Mailtrap.io</a> offers a free service you can use for testing your email features. I would use a service like this before trying to run an integration test on every customer email account in my database.</p><h1 id="cb98">Third-party services</h1><p id="7765">There are third-party services like <a href="https://sendgrid.com/">Sendgrid</a> and <a href="https://mailchimp.com/">mailchimp</a> that you can use for sending emails to your customers. The great thing about these services is they manage the complexity of staying off of email blacklists, and they offer APIs you can use for sending an email rather than having to manage your own SMTP server.</p><p id="baeb">These third-party services also allow you to maintain lists. When you are sending out bulk emails, these services can also manage the users who want to opt out of receiving any more emails.</p><h1 id="2f44">Conclusion</h1><p id="a132">There are a lot of great tools available to Node.js developers who want to leverage au

Options

tomated email services. As our Intern found out at HBO MAX, we need to very careful how we use these tools so we do not SPAM our own customers with ‘Integration Test Emails’. I am hoping that HBO is kind to this intern because this appears to be an honest mistake. Hopefully, the Intern will be able to laugh about this soon as me and my friends have been this morning.</p><p id="b66a"><b>Further reading</b></p><div id="3d99" class="link-block"> <a href="https://circuit.ooo/blog/the-key-ingredient-behind-high-newsletter-open-rates"> <div> <div> <h2>The Key Ingredient Behind High Newsletter Open Rates</h2> <div><h3>In this article, we will discuss how our 9-month-old newsletter ‘ Last Week in Plain English’ has been consistently…</h3></div> <div><p>circuit.ooo</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*e30Rh_DYRHntVlBn)"></div> </div> </div> </a> </div><p id="b26a"><i>More content at <a href="https://plainenglish.io/">PlainEnglish.io</a>. Sign up for our <a href="http://newsletter.plainenglish.io/">free weekly newsletter</a>. Follow us on <a href="https://twitter.com/inPlainEngHQ">Twitter</a></i>, <a href="https://www.linkedin.com/company/inplainenglish/"><i>LinkedIn</i></a><i>, <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw">YouTube</a>, and <a href="https://discord.gg/GtDtUAvyhW">Discord</a>. Interested in Growth Hacking? Check out <a href="https://circuit.ooo/">Circuit</a>.</i></p></article></body>

How to Create your own Integration Test Email #1 from Node.js

Find out how you can send email easily from Node.js

Photo Courtesy of Xavi Cabrera from Unspash

Originally published at https://fek.io.

Like many other HBO Max subscribers, I received an email titled “Integration Test Email #1” to the email I use for my HBO Max account. I decided to write a post about how you can send your own ‘Integration Test Email’ from Node.js. There are a couple of different ways.

Sending automated emails from a server application is something you need to be careful about. Email is typically sent out through the SMTP protocol. Internet service providers are cautious that bad actors are not using their networks for sending SPAM. So when when writing software that sends email we need to make sure that we do not do anything to get us blacklisted. It is very easy to do if you are not careful.

Nodemailer

The way I have sent email from Node.js in the past is by using a NPM module called Nodemailer. You can install it into your project by using the following terminal command.

> npm i nodemailer --save

To send out our “Integration Test Email” we can write a simple program that creates a network connection to an SMTP server.

If you are going to test sending email, you might want to start by using a fake SMTP service. Mailtrap.io offers a free service you can use for testing your email features. I would use a service like this before trying to run an integration test on every customer email account in my database.

Third-party services

There are third-party services like Sendgrid and mailchimp that you can use for sending emails to your customers. The great thing about these services is they manage the complexity of staying off of email blacklists, and they offer APIs you can use for sending an email rather than having to manage your own SMTP server.

These third-party services also allow you to maintain lists. When you are sending out bulk emails, these services can also manage the users who want to opt out of receiving any more emails.

Conclusion

There are a lot of great tools available to Node.js developers who want to leverage automated email services. As our Intern found out at HBO MAX, we need to very careful how we use these tools so we do not SPAM our own customers with ‘Integration Test Emails’. I am hoping that HBO is kind to this intern because this appears to be an honest mistake. Hopefully, the Intern will be able to laugh about this soon as me and my friends have been this morning.

Further reading

More content at PlainEnglish.io. Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord. Interested in Growth Hacking? Check out Circuit.

Nodemailer
JavaScript
Nodejs
MailChimp
Programming
Recommended from ReadMedium