and above script is not working with a group distribution list too.
can below script work for me. MAILTO="abcd@gmail.com" Subject=“certbot renew failed”
43 6 * * * certbot renew --post-hook “systemctl reload httpd” --quiet
You are using cron to send emails, your subject will be
Cron <user@hostname> your_command
this will be sent if your command has some output.
If your command doesn't have output (you are using --quiet) no email is sent.
This means that in your current configuration, you should just add your email address in the MAILTO variable and leave it alone, because you will only get an email if renewal fails:
If you’re sure that this command executes successfully without human intervention, you can add the command to crontab (since certificates are only renewed when they’re determined to be near expiry, the command can run on a regular basis, like every week or every day). In that case, you are likely to want to use the -q or --quiet quiet flag to silence all output except errors.
You should check if you can get emails from your server, though. Run
echo "Hi, ${USER}! I'm ${HOST}" | mail -s "This is the subject" youraddress@example.com
STOREDRV.Submission.Exception:SendAsDeniedException. MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message.
Where did you put that? You did run it on an actual shell, did you? You don’t need to run that command if you are sure you can get emails from your server.
I ran the command in the shell. please help me to add subject variable in crontab.
Also can we send mail to group distribution list .
Currently Running Script :
You can write it yourself by messing with crond config, but I don’t think it’s worth it. You’d have to write a script to rewrite the email and then send it.