Created
January 2, 2021 11:17
-
-
Save sabl0r/706cf23175d0015d7f0489b791c3025d to your computer and use it in GitHub Desktop.
Synology NAS cronjob mailer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env php74 | |
| <?php | |
| define('TO', '[email protected]'); | |
| define('FROM', '[email protected]'); | |
| $stdIn = trim(stream_get_contents(STDIN)); | |
| if($stdIn === ''){ | |
| exit(0); | |
| } | |
| $subject = $argv[1]; | |
| mail(TO, '[NAS] '.$subject, $stdIn, [ | |
| 'From' => FROM | |
| ]); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use in /etc/crontab like this: