# Adding HTTPS to email message links

{% hint style="info" %}
Before you begin, make sure Port 443 is open and unblocked by any other application, firewall, or SELinux policies on your server.&#x20;
{% endhint %}

{% hint style="info" %}
This should only be done after completing the steps in [free-native-ssl-via-lets-encrypt](https://docs.emaildelivery.com/docs/options-for-adding-https/free-native-ssl-via-lets-encrypt "mention")
{% endhint %}

{% hint style="success" %}
Instructions for automating the renewal of your Let's Encrypt certificate are at the end of this document, this is a one-time "set it and forget it" process.&#x20;
{% endhint %}

Log into your VPS using SSH on macOS or PuTTY on Windows.

Change directory to your ESP installation:

```
cd edcom-install
```

Run this command for each of your ESP tracking domains (email message links) and provide your  subdomain and domain as an argument.

```
./generate_link_certificate.sh link.yourdomain.com
```

**\*\*\* Note:** Use the the real subdomain and domain of your tracking link above, not link.yourdomain.com, this is just a placeholder. This is the domain in your email messages using http\:// currently.

If you've never run this command previously, you must do it now to enable HTTPS:// support.

If you've run this command in a previous step **do not run it a second time**.

```
./convert_to_ssl.sh
```

Restart your ESP:&#x20;

```
./restart.sh
```

{% hint style="info" %}
**Create an automated cron job that renews your link's Let's Encrypt certificate.**&#x20;
{% endhint %}

Run the following command and when you're asked which editor to use, select nano:

```
crontab -e
```

<figure><img src="https://2024949584-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNgw7cfnOYHQr0B6GDXr%2Fuploads%2F3guDnx4TvNvTsY5eZ32Y%2FScreenshot%202024-01-04%20at%204.08.17%E2%80%AFPM.png?alt=media&#x26;token=a38f423f-ab4b-49b0-8ad5-8e06f574283e" alt=""><figcaption></figcaption></figure>

Copy and paste the following into the bottom of the editor, change the placeholder domain to your real tracking link domain, and hit ctrl-x to save:

{% code overflow="wrap" %}

```
* * */30 * * cd /root/edcom-install && ./renew_link_certificate.sh link.yourdomain.com > data/logs/certbot.log 2>&1
```

{% endcode %}

**\*\*\* Note:** Use the the real subdomain and domain of your tracking link above, not link.yourdomain.com, this is just a placeholder. This is the domain in your email messages using http\:// currently.

**\*\*\* Note:** If your ESP is installed somewhere else other than /root/edcom-install you will need to modify that as well.

{% hint style="success" %}
**You're done!**\
Your email links should be secured with https\:// going forward.&#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/options-for-adding-https/adding-https-to-email-message-links.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.
