acme.sh can send notifications in its cronjob.
Every night when the renew cronjob runs, you may receive notifications based on
--notify-level 0|1|2|3 Set the notification level: Default value is 2. 0: disabled, no notification will be sent. 1: send notification only when there is an error. No news is good news. 2: send notification when a cert is successfully renewed, or there is an error 3: send notification when a cert is skipped, renewed, or error. You will receive notification every night with this level. --notify-mode 0|1 Set notification mode. Default value is 0. 0: Bulk mode. Send all the domain's notifications in one message(email) 1: Cert mode. Send a message for every single cert. You may receive a bulk of emails in one night. --notify-hook [hookname] Set the notify hook
The notifications can be emails for another supported way, such as request to a webhook etc.
As for now, there is email notification supported, but there will be more soon. You can also implement your hook.
acme.sh --set-notify [--notify-hook mailgun] acme.sh --set-notify [--notify-level 2] acme.sh --set-notify [--notify-mode 0]
There can be multiple
acme.sh --set-notify --notify-hook mailgun --notify-hook mail
And, all the parameters can be used together:
acme.sh --set-notify --notify-hook mailgun --notify-hook mail \ --set-notify --notify-level 2 \ --set-notify --notify-mode 0
1. Set notification for mailgun.com
Send notification by mailgun.com api. The notification email will be sent to your email address.
Please register a free account at mailgun.com, you will get your api key.
If you don't have a domain, you can use the sandbox domain in your account.
It looks like
If you use the sandbox domain, you must add your receiving email address as an "Authorized recipient"
#The api key in your account. export MAILGUN_API_KEY="xxxxxxxx" #The api domain, you can use the sandbox domain in your account. export MAILGUN_API_DOMAIN="xxxxxx.com" #Optional, the mail from address. it must be user@MAILGUN_API_DOMAIN export MAILGUN_FROM="firstname.lastname@example.org" #The mail to address, which is to receive the notification. export MAILGUN_TO="email@example.com" #Optional, if your mailgun account is in eu region, you must set MAILGUN_REGION export MAILGUN_REGION="us|eu" #optional, use "us" as default acme.sh --set-notify --notify-hook mailgun
2. Set notification for sendgrid.com
export SENDGRID_API_KEY="xxxxxxxxxx" export SENDGRID_FROM="firstname.lastname@example.org" export SENDGRID_TO="email@example.com" acme.sh --set-notify --notify-hook sendgrid
3. Set notification for mail
Set it in your systems environment:
export MAIL_FROM="firstname.lastname@example.org" # currently work only with sendmail export MAIL_TO="email@example.com" # your account e-mail will be used as default if available
It will try to find and use
If you want to specify which application to use, please use
export MAIL_BIN="sendmail" # should be one of following: sendmail, ssmtp, mutt or mail
Ok, let's set notification hook:
acme.sh --set-notify --notify-hook mail
MAIL_FROM will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4. Set notification for Slack Webhooks
First get your Slack Webhook URL, then set it in your systems environment:
export SLACK_WEBHOOK_URL="..." export SLACK_CHANNEL="..." # overwrites Slack Webhook channel export SLACK_USERNAME="..." # overwrites Slack Webhook username
Ok, let's set notification hook:
acme.sh --set-notify --notify-hook slack
SLACK_USERNAME will be saved in ~/.acme.sh/account.conf and will be reused when needed.