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
- 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,
--serveras opposed to the short form,
- 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:
Ensure Email Delivery is configured to send email. See Getting Started with Email Delivery.
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
To send a test email with Swaks, run the following command:
swaks --pipeline -tls --server <smtp.region.oraclecloud.com> --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>'
swaks --pipeline -tls --server smtp.us-ashburn-1.oraclecloud.com --port 25 --auth-user 'ocid1.user.oc1..<unique_ID>' --auth-pass '<password>' --from 'firstname.lastname@example.org' --to 'email@example.com' --data 'From: firstname.lastname@example.org\nDate: Thu, 13 Sep 2019\nSubject: Test Send\n\nTest email'
Note the following when sending email with Swaks:
-tlsparameter is required.
--pipelineparameter is supported to make use of SMTP pipelining.
--port <number>parameter or
:<port number>syntax can be used to specify the port.
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.
- See the Swaks documentation for more information.