MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 2 as of 2013-09-03 20:02:57
  • CommandLineMail

CommandLineMail

Examples of sending email through a script on Linux.

Example 1

   1 #!/bin/sh
   2 #/home/user/sendemailscript.sh
   3 CURRDATE=`date -u "+%Y-%m-%dT%H:%m:%S.%Z"`
   4 FILE=/tmp/reportx$CURRDATE.txt
   5 SUBJECT="Report subject"
   6 BODY="Report body ...."
   7 MAILDESTINATION="dest1@example.org dest2@example.org"
   8 /usr/bin/python /home/user/script.py > $FILE
   9 echo $BODY | /bin/mail -a $FILE -s "$SUBJECT" -- $MAILDESTINATION
  10 #crontab -e  # run script at Six AM
  11 #0 6 * * * /home/user/sendemailscript.sh
  12 
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01