By default, emails generated by Hestia (Notifications, Forgot password, update logs, etc.) are sent the internal mail. If you want, you can setup mail to be send over a SMTP account.
Execute the following script and follow the instructions:
bash /usr/local/hestia/install/upgrade/manual/configure-server-smtp.sh
The script will ask you for the following SMTP parameters:
smtp.example.com)25, 465 or 587)STARTTLS)First, check that port 25 is open for outgoing traffic. A lot of providers block port 25 by default to combat spam.
To do so, run the following command:
telnet ASPMX.L.GOOGLE.COM 25
If the connection was successful you will see something similar to this:
Trying 2a00:1450:400c:c00::1b...
Connected to ASPMX.L.GOOGLE.COM.
Escape character is '^]'.
220 mx.google.com ESMTP a7si1253985wrr.455 - gsmtp
If not, you have 2 options:
SMTP mail relay is the process of transferring an email from one server to another for delivery. Often email from a server is blocked by the service provider due to fear of spam. Or the IP reputation is so low that all email go straight into the spam box. To prevent such issues a lot of companies offer a SMTP relay that takes care of the delivery part. As they send a lot email via the same ip addresses they have a better reputation.
To setup create a account by the provider you want or use and follow their instruction to update your DNS. When completed you can enter the SMTP user account they provider in the settings under "Global SMTP" or under the "Edit mail domain" -> "SMTP relay"
If you are unable to receive emails, make sure you have setup your DNS properly. If you are using Cloudflare, disable the use of the proxy for mail.domain.tld.
When you are done you can check the configuration via MXToolBox.
https://www.spamhaus.org/returnc/pub/65.1.174.102HereYourQueryKey.zen.dq.spamhaus.netzen.spamhaus.org with HereYourQueryKey.zen.dq.spamhaus.netdeny message = Rejected because $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text to deny message = Rejected because $sender_host_address is in a black list at ${if match{$dnslist_domain}{.*zen.dq.spamhaus.*}{zen.dq.spamhaus.net}{$dnslist_domain}}\n$dnslist_text to prevent your Query key from leakingIf you use an SMTP relay or want to use DKIM on your web server but host email on gmail you need to disable internal lookup in Exim4.
nano /etc/exim4/exim4.conf.template
dnslookup:
driver = dnslookup
domains = !+local_domains
transport = remote_smtp
no_more
Replace with:
dnslookup:
driver = dnslookup
domains = *
transport = remote_smtp
no_more
You can install SnappyMail by running the following command:
v-add-sys-snappymail
In the root folder, there is a file called .snappymail containing the username and password:
Username: admin_f0e5a5aa
Password: D0ung4naLOptuaa
Secret key: admin_f0e5a5aa
You can access the admin by navigating to https://webmail.domain.tld/?admin_f0e5a5aa, and login by using the data you found in the file. Once it’s not needed anymore, remove the file, for security reasons.
No, Cloudflare’s Proxy does not work with email. If you use email hosted on you server, make sure the proxy for the A record mail.domain.tld is switched off. Otherwise, you will not be able receive emails. The following records are suggested if you want to use Hestia as your mail server:
mail.domain.tld.v=spf1 a mx ip4:your ip; \~allt=y; o=~;t=y; o=~DKIM key;v=DMARC1; p=quarantine; sp=quarantine; adkim=s; aspf=s;The DKIM key and SPF record can be found in the Mail Domains list (documentation).
Make sure you have set up the correct RDNS, SPF records and DKIM records.
If this doesn’t work, it’s be possible that your IP address is on one or more blacklists. You can try to unblock yourself, but often the easier method is to use SMTP and SMTP Relay with Amazon SES or another SMTP provider.
During Hestia’s installation, use the --sieve flag. If Hestia is already installed, there is a an upgrade script provided at the following path: /usr/local/hestia/install/upgrade/manual/install_sieve.sh
Open port 4190 in the firewall. Read the firewall documentation.
Edit /etc/snappymail/data/_data_/_default_/domains/default.json and modify the following settings:
"Sieve": {
"host": "localhost",
"port": 4190,
"type": 0,
"timeout": 10,
"shortLogin": false,
"lowerLogin": true,
"sasl": [
"SCRAM-SHA3-512",
"SCRAM-SHA-512",
"SCRAM-SHA-256",
"SCRAM-SHA-1",
"PLAIN",
"LOGIN"
],
"ssl": {
"verify_peer": false,
"verify_peer_name": false,
"allow_self_signed": false,
"SNI_enabled": true,
"disable_compression": true,
"security_level": 1
},
"enabled": false # Change this to true
},
If you want to use the SMTP from Oracle Cloud you need to make the following changes to Exim4 Configuration:
Open /etc/exim4/exim4.conf.template and replace the following code:
smtp_relay_login:
driver = plaintext
public_name = LOGIN
hide client_send = : SMTP_RELAY_USER : SMTP_RELAY_PASS
With:
smtp_relay_login:
driver = plaintext
public_name = PLAIN
hide client_send = ^SMTP_RELAY_USER^SMTP_RELAY_PASS
Some SMTP relay services might require you to set the domain within the SMTP relay account. To automate this hooks have been added to v-add-mail-domain and v-delete-mail domains.
Create: $HESTIA/data/extensions/add-mail-domain.sh and $HESTIA/data/extensions/v-delete-mail-domain.sh
See: Github
# v-add-mail-domain
SMTP_RELAY_PMG_USER="user"
SMTP_RELAY_PMG_PASS="password"
SMTP_RELAY_PMG_HOST="host"
SMTP_RELAY_PMG_PORT="port"
pmg_auth=$(curl -s --request POST -d "username=$SMTP_RELAY_PMG_USER&password=$SMTP_RELAY_PMG_PASS" \
--url https://$SMTP_RELAY_PMG_HOST:$SMTP_RELAY_PMG_PORT/api2/json/access/ticket)
pmg_ticket=$(echo $pmg_auth | jq -r '.data.ticket')
pmg_csrf=$(echo $pmg_auth | jq -r '.data.CSRFPreventionToken')
if [ -n "$pmg_ticket" ]; then
pmg_config_domain=$(curl -s --request POST -d "domain=$domain" \
-H "CSRFPreventionToken: $pmg_csrf" -H "Cookie: PMGAuthCookie=$pmg_ticket" \
https://$SMTP_RELAY_PMG_HOST:$SMTP_RELAY_PMG_PORT/api2/json/config/domains)
pmg_config_transport=$(curl -s --request POST -d "domain=$domain&host=$SMTP_RELAY_PMG_LOCAL_IP" \
-H "CSRFPreventionToken: $pmg_csrf" -H "Cookie: PMGAuthCookie=$pmg_ticket" \
https://$SMTP_RELAY_PMG_HOST:$SMTP_RELAY_PMG_PORT/api2/json/config/transport)
fi
# v-delete-mail-domain.sh
SMTP_RELAY_PMG_USER="user"
SMTP_RELAY_PMG_PASS="password"
SMTP_RELAY_PMG_HOST="host"
SMTP_RELAY_PMG_PORT="port"
if [ -n "$SMTP_RELAY_PMG" ]; then
pmg_auth=$(curl -s --request POST -d "username=$SMTP_RELAY_PMG_USER&password=$SMTP_RELAY_PMG_PASS" \
--url https://$SMTP_RELAY_PMG_HOST:$SMTP_RELAY_PMG_PORT/api2/json/access/ticket)
pmg_ticket=$(echo $pmg_auth | jq -r '.data.ticket')
pmg_csrf=$(echo $pmg_auth | jq -r '.data.CSRFPreventionToken')
if [ -n "$pmg_ticket" ]; then
pmg_config_domain=$(curl -s --request DELETE \
-H "CSRFPreventionToken: $pmg_csrf" -H "Cookie: PMGAuthCookie=$pmg_ticket" \
https://$SMTP_RELAY_PMG_HOST:$SMTP_RELAY_PMG_PORT/api2/json/config/domains/$domain)
pmg_config_transport=$(curl -s --request DELETE \
-H "CSRFPreventionToken: $pmg_csrf" -H "Cookie: PMGAuthCookie=$pmg_ticket" \
https://$SMTP_RELAY_PMG_HOST:$SMTP_RELAY_PMG_PORT/api2/json/config/transport/$domain)
fi
fi