# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emaildelivery.com/docs/transactional/use-swaks-for-testing-and-troubleshooting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
