SMTP Injection with STARTTLS using swaks

June 16, 2017 Contributors

One of our customers recently ran into issues attempting to send a test email via SMTP injection using STARTTLS while working with the openssl client. Our resolution is to utilize the “swaks” (Swiss Army Knife for SMTP). This command line utility makes it easy to send a test email via SMPTP and provides verbose output so you’re able to view the commands and responses issued by the utility and received from the server.


  • A valid SparkPost API key with the “send with SMTP” permission enabled
  • A valid sending domain configured

# Sending a Test Email Using swaks

Once you have swaks downloaded (optionally available in your PATH), you can send a test email using SparkPost SMTP injection by running the following command in a terminal window:


  • API_KEY – An api key created in with “Send via SMTP” permission
  • TO_EMAIL – The email address of the test email recipient
  • FROM_EMAIL – An email address on a configured Sending Domain

If you ever need the SMTP Connection information for SparkPost, it is available in the Account section of the SparkPost UI.

# Sample Response