The smtp-protocol module can be used for creating clients too, so let's make a client and use it alongside our SMTP server from the main recipe.
Let's copy the smtp-server folder, naming the duplicate smtp-client.
We don't need to install any new dependencies, so let's simply clear the contents of index.js and open it in our favorite editor.
Let's start by requiring the dependencies:
const os = require('os') const readline = require('readline') const smtp = require('smtp-protocol')
We're going to use the core readline module as a user interface, creating an interactive shell for sending mail. Let's create a readline interface instance:
const rl = readline.createInterface({ input: process.stdin, output: process.stdout, ...