> For the complete documentation index, see [llms.txt](https://docs.emaildelivery.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emaildelivery.com/docs/transactional/use-swaks-for-testing-and-troubleshooting.md).

# Use SWAKS for testing and troubleshooting

{% hint style="info" %}
**SWAKS is a vital tool to learn for testing and troubleshooting your ESP platform.**

When you use SWAKS for troubleshooting, you're reducing variables and confounders that may be caused by the software you're introducing into your email ecosystem.
{% endhint %}

Install SWAKS using one of the methods on their installation page:

{% embed url="<https://www.jetmore.org/john/code/swaks/installation.html>" %}

Test to see if you can connect to a port on your ESP platform using the DNS hostname:

{% code overflow="wrap" %}

```
swaks --server transactional.fivetacofiesta.com --port 587 -q connect
```

{% endcode %}

A successful connection will look something like the following:

<figure><img src="/files/7SQwdY2DHF9yNIrAdO4S" alt=""><figcaption></figcaption></figure>

If connecting using the DNS hostname fails, try the IP address of your VPS instead:

```
swaks --server 1.2.3.4 --port 587 -q connect
```

**\*\*\* Note:** You must use the real IP address of your Linux VPS above, not "1.2.3.4", it's a placeholder.&#x20;

{% hint style="info" %}
**SWAKS syntax basics**

Type swaks --help to see some example use cases and documentation.&#x20;
{% endhint %}

```
--from sender@my.domain.com   
--to recipient@domain.com  
--server esp.domain.com    
--port 587                 
--auth LOGIN               
--auth-user API Key        
--auth-password API Key    
--header "Subject: hello from SWAKS"
--body "This is a SWAKS demo" 
```

Use the real email address you want to send this message from here:

```
--from sender@my.domain.com
```

Use the real email address you want to send this message to here:

```
--to recipient@domain.com  
```

Your ESP platform DNS or IP:

```
--server esp.domain.com 
```

Your ESP platform listens for STMP Relay on Ports 587, 2525, and 8025:

```
--port 587 
```

Tell your ESP platform to use a username and password for authentication:

```
--auth LOGIN 
```

Use your user API Key for your username:

```
--auth-user S8PHFSJyyc7GuYbJ2SHFVq
```

**\*\*\* Note:** You must use your real user account API Key above, not "S8PHFSJyyc7GuYbJ2SHFVq", it's a placeholder.

Use your user API Key for your password:

```
--auth-password S8PHFSJyyc7GuYbJ2SHFVq
```

**\*\*\* Note:** You must use your real user account API Key above, not "S8PHFSJyyc7GuYbJ2SHFVq", it's a placeholder.

{% hint style="info" %}
**Putting it all together:**
{% endhint %}

<figure><img src="/files/rNlkCVNTthzImocL2Iqq" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**A successful message will look something like the following:**&#x20;
{% endhint %}

<figure><img src="/files/a59Gly2jNRJtx9k61gLw" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Using your ESP platform's custom SMTP headers with SWAKS:**
{% endhint %}

Tag your message:

<pre><code><strong>--header "X-Transactional-Tag: SWAKS"
</strong></code></pre>

Choose a postal route for this message:

```
--header "X-Transactional-Route: AjdytEc4dzfYhuk9nWCq6Y"
```

**\*\*\* Note:** You must use the real postal route ID above, not "AjdytEc4dzfYhuk9nWCq6Y", it's a placeholder.

Use a transactional template for this message instead of --body:

```
--header "X-Transactional-Template: MsmsEaZZDxYyBJyVXXwA2A"
```

**\*\*\* Note:** You must use the real transactional template ID above, not "MsmsEaZZDxYyBJyVXXwA2A", it's a placeholder.

{% hint style="success" %}
**ChatGPT is an expert SWAKS user.**&#x20;

Ask it how to do *anything* you need to test with SWAKS and it will know.&#x20;
{% endhint %}
