Oracle Cloud Infrastructure Documentation

Integrating Swaks with Email Delivery

Swaks (Swiss Army Knife SMTP) is a transaction-based tool you can use to test SMTP configurations in Email Delivery. Before you use Swaks, you must configure Email Delivery and take note of your SMTP sending information and SMTP credentials.


Many options and parameters can be used to test various scenarios with Swaks. When Swaks evaluates an option (that is, a flag with parameters), it does so in three steps:

  • First, it looks for a configuration file (default location or specified with --config).
  • Next, it looks for options in environment variables.
  • Finally, it looks at command line options. At each step, any options set earlier are overridden.


The following procedures assume the following:

  • The following example supplies options to Swaks via the command line in long form, for example, --server as opposed to the short form, -s.
  • The following example assumes the default behavior to connect through network sockets.
  • A local certificate is not required for a TLS connection to be negotiated. The following example assumes the default behavior where Swaks does not attempt certificate verification.
  • Swaks is primarily intended for use on UNIX-like operating systems with functionality based on known standards so it should work on most modern mail servers.

Configure Swaks to Send Email Through Email Delivery

To enable Swaks to test the configuration of Email Delivery:

  1. Ensure Email Delivery is configured to send email. See Getting Started with Email Delivery.

  2. Note

    The SMTP credentials are required to configure Swaks to use Email Delivery. Be sure to note the user name and password when you generate the SMTP credentials.

  3. Ensure Swaks is installed. The installation process differs depending on which operating system you are using. For example, run the following command to install Swaks on Oracle Linux:

    sudo yum install swaks -y
  4. To send a test email with Swaks, run the following command:

    swaks --pipeline -tls --server <> --port <587 or 25> --auth-user '<username OCID from SMTP credentials>' --auth-pass '<password>' --from '<sender email address>' --to '<recipient email address>' --data '<email message>'

    For example:

    swaks --pipeline -tls --server --port 25 --auth-user 'ocid1.user.oc1..<unique_ID>' --auth-pass '<password>' --from '' --to '' --data 'From:\nDate: Thu, 13 Sep 2019\nSubject: Test Send\n\nTest email'

    Note the following when sending email with Swaks:

    • The -tls parameter is required.
    • The --pipeline parameter is supported to make use of SMTP pipelining.
    • The --port <number> parameter or :<port number> syntax can be used to specify the port.

More Information