V4 logging email errors


#1

Hi there,

We’re slowly moving to V4 and although emails are working perfectly, the setup is missing something as it keeps logging this error:

Jan 21 20:53:59 ip-xxxxxxxxx mydomain.com/smtpd[10882]: error: open database /etc/aliases.db: No such file or directory

There’s no changes to the container other than standard WP install. Is there any step to fix that or am I missing some step to fully setup emails? Although it’s not a big issue, it’s quite distracting having those logs all over mail.log file.


Function mail() PHP not working. I can't sending email
#2

Found this googling the same problem, and couldn’t find a good rundown of the problem elsewhere. Apparently this bug still exists 5 months later.

To build on ralf’s answer in the other thread, the problem was that the aliases file didn’t exist and also that it was trying to deliver mail locally for the host’s domain due to default settings.

To fix it first log into the postfix shell:

ee shell mywebsite.com --service=postfix

Then create the /etc/aliases file:

cd /etc
cat > aliases
[Ctrl + D]

And run:

postalias /etc/aliases
newaliases

(re: https://serverfault.com/questions/683243/postfix-aliases-db-no-such-file-or-directory)

Then edit /etc/postfix/main.cf:

nano /etc/postfix/main.cf

Update this setting to remove your own domain:

mydestination = localhost

And comment out these if they exist:

#virtual_mailbox_domains = 
#virtual_alias_maps = 
#virtual_mailbox_maps = 

(re: https://www.digitalocean.com/community/questions/postfix-won-t-send-to-external-server-with-same-domain-name)

Last, exit the shell:

exit

And restart postfix’s container:

docker ps
[find postfix's container name]
docker restart postfix_container_name

I don’t really know if all this is necessary because I don’t know much about postfix, but it seems to be working now so ¯_(ツ)_/¯