# Email Logs
All email logs are stored persistently and can be accessed from the host system without entering a container. The following log file locations may be useful for diagnosing issues.
# Mailbox data location
The Maildir for each mailbox can be found in /var/local/enhance/email/mailboxes/{websiteId}/{emailAddress}
where {websiteId}
is the ID of the website the email belongs to and {emailAddress}
is the full email address.
These files are owned by the website user and the best way to access them is to ssh or su to the website user first. If you make changes to these files as root, it will cause permission issues for the user or for any backup/restore processes.
# Postfix (MTA)
Postfix logs are in /var/log/postfix.log
.
These logs will contain incoming and outgoing messages. If you are looking for the cause of a non-delivery, this is the log to look at.
# Troubleshooting non-delivery
- For inbound messages, if the domain has external DNS, check this is set to the correct server on which the website's email role is placed. The easiest way to get this information is from the website dashboard, look for the "mail IP".
- For outgoing messages, if the DNS is external, check the SPF and DKIM records (if applicable) are configured properly.
- Check with your server provider that your server's primary ipv4 and ipv6 addresses have a valid PTR record pointing back to your server hostname.
- Many VPS/Cloud providers block outgoing port 25 which will prevent your server from delivering messages to external recipients. You can easily test this by running
telnet smtp.gmail.com 25
as root. You should see a mail server greeting. If you see a timeout, your provider is probably blocking port 25 and you will need to either ask your provider to lift this restriction or user a smart host provider.
# Managing the mail queue
- To view the mail queue, run
mailq
as root. - To delete the contents of the mail queue, run
postsuper -d ALL
. - Further reading on postfix queue management (opens new window)
# POP/IMAP (Dovecot)
To view the Dovecot log (POP/IMAP operations) run journalctl -u dovecot
as root. If a customer is unable to log in to their email, this is the log to look at.
# Spam filter (rspamd)
The rspamd config is in /etc/rspamd
and most of it can be modified without being affected by Enhance updates. The rspamd log is at /var/log/rspamd.log
.
# Sender rewriting (SRS)
Messages which are forwarded to other addresses will have their sender rewritten to the original recipient of the message, to help them pass SPF checks. This is handled by a milter called srs_milter
.