Caddy works really great, but i want to make sure that i will receive an email in case there is any problems with certificate renewal. What is the best way to force an email to be sent to the configured email address ? Who sends the mail, is it Caddy or the CA like let’s encrypt ?
4. Error messages and/or full log output:
N/A
5. What I already tried:
I hoped that i would get an email when initially creating the certificates, it would be an good way to make sure that the email is correctly configured and email is recieved.
OK, yes now i see that the email is used when registering with the CA. I would believe that email sending is enabled for all CAs. It would be nice to have the enabling of the notification email explicit in the caddy logs so that it is possible to see that the email was actually used when issueing the certificates. Also not sure if it is supported by the CAs, but to make it possible via Caddy to retrieve and maybe update the notification email in the CA. It seems that Certbot can do this.
If the email is changed in the Caddy config, will this have any effect in the CAs ?
The expiration emails as far as I know is something exclusive to Let’s Encrypt Expiration Emails - Let's Encrypt. Caddy starts attempts to renew the certificates when there’s only 1/3 of its lifetime remaining (so 90 day certs means after 60 days, i.e. 30 days remaining) but Let’s Encrypt only sends the email when you get to20 days, 10 days and 1 day remaining. So during normal operation, you’ll never get an email unless you turn off Caddy or stop using the domain.
IMO you’re putting too high an importance on this email, it should just be an “if all else fails” notification. I recommend setting up your own tooling to warn you if either Caddy emits errors, or check your site yourself with a cron to make sure the certificate’s remaining lifetime hasn’t gotten too low (which should only happen if Caddy had errors in renewal).
If you change the email, it’ll only affect future certificate issuances, it won’t affect already issued certificates – the email would be sent to the old email address used at the time the certificate was issued.