Setting up a Raspberry PI as an EMAIL/WEB SERVER

Later fixes

"If anything can go wrong, it will." Murphy's Law:

These are things that are found with the system after it has gone live. They are normally not things that initial testing could be expected to find but are needed to be fixed for the smooth running of the system.

Email not working after Reboot

When the Server is re-booted then the email system does not function.
After investigation the following commands
sudo service dovecot status
showed that dovecot was not running correctly.
The following commands resolved the issue.
sudo systemctl stop dovecot
sudo systemctl enable dovecot
sudo systemctl restart dovecot
sudo service postfix restart
I came to the conclusion that this was occurring probably because dovecot tried to start too soon, before some of the other services it needed had started.
Note item pi in blue needs to be changed to the admin user that you created when setting up the operating system.
The solution was to create a script /home/pi/bin/mailreset.sh
as
sudo logger "Starting Reset of Email System, running Script [" $0 "]"
#wait 100 seconds for the rest to initialise
sleep 100
sudo logger " Stop DOVECOT"
sudo systemctl stop dovecot
sudo logger " Enable DOVECOT"
sudo systemctl enable dovecot
sudo logger " Restart DOVECOT"
sudo systemctl restart dovecot
sudo logger " Restart POSTFIX"
sudo service postfix restart
sudo logger "Finished Reset of Email System, with Script [" $0 "]"

and set it to run on boot up in crontab with
crontab -e
and then add the line below at the end
@reboot sudo /home/pi/bin/mailreset.sh
This resolved the issue.

Reconnection of Electricity Issue

After a power cut or disconnection when power is restored the Argon one v1 case does not restart. It requires the power button pressing. This means that it would stay switched off when power is restored. There is an article on this in Argon-ONE-i2c-Codes
It shows that command
sudo i2cset -y 1 0x01a 0xfe
changes this so that it boots up when power returns without manual intervention.
This only works for Argon one V1
For Argon one V2 There is article Manual Argon One Case for Raspberry Pi 4 V2(see step 4 page 6)

It requires jumper changes on the argon pcb
default is header in 1-2.
changing it to 2-3 sets it to boot up when power is restored.

SSL Renewal Issues (Letsencrypt)

The email client I was using started saying the SSL certificate is out of date.
On investigation the SSL certificate was renewed but the email server was still using the old certificate.
A reboot of raspberry pi server resolved the issue.
We need to add a regular reboot of the server using cron as certificates are renewed more than one week before expiry.
To solve problem of out of date certificates being used by web site and email then a scheduled reboot has been set up which resets to use the latest certificates
Added a reboot each day at 05:00 with:
crontab -e
added line
0 5 * * * sudo shutdown -r now
This resolved the issue.