# Email Service

Starting v4.2.0, you'll be able to share your peers with email. To enable it, simply head to **Settings > WGDashboard Settings**.

{% hint style="warning" %}
Currently, WGDashboard only supports SMTP and SMTP w/ TLS. Please make sure your email provider supports logging in with SMTP. With the author's experiments, the free tiers of Outlook and Gmail disabled SMTP and no longer have the ability to enable it.
{% endhint %}

{% stepper %}
{% step %}

### Configure Email Account

Scroll down to the **Email Account** section.
{% endstep %}

{% step %}

### Fill in the following fields

| Field         | Example                                                                                                             |
| ------------- | ------------------------------------------------------------------------------------------------------------------- |
| Server        | `smtp.qq.com`                                                                                                       |
| Port          | `567`                                                                                                               |
| Encryption    |                                                                                                                     |
| Username      | `example@qq.com` or `username` from your mail service provider                                                      |
| Password      |                                                                                                                     |
| Send From     | Email address you want to send from: `example@qq.com`. Or if you want a name with it: `Donald Zou <example@qq.com>` |
| {% endstep %} |                                                                                                                     |

{% step %}

### Ready indicator

Once everything is filled, you should see a green **Ready** top right of the form.
{% endstep %}

{% step %}

### Test email

Try to send a test email and see if everything works.
{% endstep %}

{% step %}

### Edit Email Body Template

If the test email works, you can start editing the **Email Body Template**. Please read the following for details.
{% endstep %}
{% endstepper %}

Email Body Template

The template uses the Jinja template engine to generate an HTML body for your email. In your template, there are two variables you can use:

* peer

  Example:

```json
{
   "DNS": "",
   "ShareLink": [],
   "allowed_ip": "10.0.0.3/32, 2001:db8:64:49::3/128",
   "configuration": {
      "Address": "10.0.0.1/28, 2001:db8:64:49::1/64",
      "ConnectedPeers": 0,
      "DataUsage": {
         "Receive": 0,
         "Sent": 0,
         "Total": 0
      },
      "ListenPort": "51823",
      "Name": "wg-external",
      "PostDown": "",
      "PostUp": "",
      "PreDown": "",
      "PreUp": "",
      "PrivateKey": "aC98hORPAbbxXZmy8qy1JP9Ip3JtEhbjDTOGtgHvmmg=",
      "Protocol": "wg",
      "PublicKey": "upH8PMbMzpcynJXz09Vldye09vzAmmNRV40hR+Vhbyw=",
      "SaveConfig": true,
      "Status": true,
      "TotalPeers": 13
   },
   "cumu_data": 0,
   "cumu_receive": 0,
   "cumu_sent": 0,
   "endpoint": "(none)",
   "endpoint_allowed_ip": "0.0.0.0/0",
   "id": "Wu/0xCr+n/caqDVKtjG+C9UelAvY/beARX3cW1i7LUI=",
   "jobs": [],
   "keepalive": 21,
   "latest_handshake": "No Handshake",
   "mtu": 1420,
   "name": "",
   "preshared_key": "",
   "private_key": "ABgsivKkBd6K9LizqHm/pDjfq2HRNESjdJBIz4RMlkE=",
   "remote_endpoint": "wg.local",
   "status": "stopped",
   "total_data": 0,
   "total_receive": 0,
   "total_sent": 0
}
```

* configurationFile

  Example:

```json
{
  "fileName": "UntitledPeer",
  "file": "[Interface]\\nPrivateKey = ABgsivKkBd6K9LizqHm/pDjfq2HRNESjdJBIz4RMlkE=\\nAddress = 10.0.0.3/32, 2001:db8:64:49::3/128\\nMTU = 1420\\n\\n[Peer]\\nPublicKey = upH8PMbMzpcynJXz09Vldye09vzAmmNRV40hR+Vhbyw=\\nAllowedIPs = 0.0.0.0/0\\nEndpoint = vpn.example.com:51823\\nPersistentKeepalive = 21\\n"
}
```

Example template and result

Template:

```
Hi,

Your WireGuard configuration is ready with the name "{{ peer.name }}", and its allowed IP address is: {{ peer.allowed_ip }}.

Please see the attached configuration file "{{ configurationFile.fileName }}" and open it on your iPhone with the WireGuard app. If you can't, please copy the following lines into a raw .conf file and send it to your phone:

------- Configuration start below this line -------

{{ configurationFile.file }}

------- Configuration end below this line -------

Best,
Donald Zou
```

Rendered result:

```
Hi,

Your WireGuard configuration is ready with the name "", and its allowed IP address is: 10.0.0.3/32, 2001:db8:64:49::3/128.

Please see the attached configuration file "UntitledPeer" and open it on your iPhone with the WireGuard app. If you can't, please copy the following lines into a raw .conf file and send it to your phone:

------- Configuration start below this line -------

[Interface]
PrivateKey = ABgsivKkBd6K9LizqHm/pDjfq2HRNESjdJBIz4RMlkE=
Address = 10.0.0.3/32, 2001:db8:64:49::3/128
MTU = 1420

[Peer]
PublicKey = upH8PMbMzpcynJXz09Vldye09vzAmmNRV40hR+Vhbyw=
AllowedIPs = 0.0.0.0/0
Endpoint = vpn.example.com:51823
PersistentKeepalive = 21

------- Configuration end below this line -------

Best,
Donald Zou
```

Please be aware that the template may reveal sensitive information like your configuration. Check the content carefully before sending.


---

# 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://qubitvpn.gitbook.io/qubitvpn-docs/how-to-use/how-to-use-the-premium-plan/email-service.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.
