How to send an email when execute a crontab task
Would like to send an email when your crontab task has executed?
Let’s edit your crontab just typing:
In your first line just put these parameters. Remember if you are using VI, you have to use “ESC + i” to activate insert mode:
MAILTO="[email protected]_server.com" 59 10 * * * echo test
These commands will execute on 10:59am and is gonna print just test on background shell. Just for test our email. Of course that you have to be your sendmail activated on your server.
To save using VI, just type: “ESC + x”
To check if this commands are saved just type: