Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is a subject
- This is a message...
- ... on several lines
- #!/bin/bash
- function sendit {
- FROM_MAIL="mail-that-will-send@domain.com"
- RCPT_MAIL="my-email-to-test@domain.com"
- SUBJECT=$(head -n 1 $1)
- MESSAGE=$(tail -n +2 $1)
- echo -e "$MESSAGE" |mail -s "$SUBJECT" -r $FROM_MAIL $RCPT_MAIL
- }
- # Note, time is EDT, it correspond to the date of my server
- sendit mail1.txt|at 02:37 May 03
- sendit mail2.txt|at 02:38 May 03
- sendit mail3.txt|at 03:13 May 03
- [...]
- $ bash script.sh
- warning: commands will be executed using /bin/sh
- job 35 at Tue May 3 02:37:00 2016
- warning: commands will be executed using /bin/sh
- job 36 at Tue May 3 02:38:00 2016
- warning: commands will be executed using /bin/sh
- job 37 at Tue May 3 03:13:00 2016
- [...]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement