Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. This is a subject
  2. This is a message...
  3. ... on several lines
  4.  
  5. #!/bin/bash
  6.  
  7. function sendit {
  8. FROM_MAIL="mail-that-will-send@domain.com"
  9. RCPT_MAIL="my-email-to-test@domain.com"
  10.  
  11. SUBJECT=$(head -n 1 $1)
  12. MESSAGE=$(tail -n +2 $1)
  13.  
  14. echo -e "$MESSAGE" |mail -s "$SUBJECT" -r $FROM_MAIL $RCPT_MAIL
  15. }
  16.  
  17. # Note, time is EDT, it correspond to the date of my server
  18. sendit mail1.txt|at 02:37 May 03
  19. sendit mail2.txt|at 02:38 May 03
  20. sendit mail3.txt|at 03:13 May 03
  21. [...]
  22.  
  23. $ bash script.sh
  24. warning: commands will be executed using /bin/sh
  25. job 35 at Tue May 3 02:37:00 2016
  26. warning: commands will be executed using /bin/sh
  27. job 36 at Tue May 3 02:38:00 2016
  28. warning: commands will be executed using /bin/sh
  29. job 37 at Tue May 3 03:13:00 2016
  30. [...]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement