3 # mail-calendar - send information about historical dates
4 # Copyright (c) 2002,3 Martin Schulze <joey@infodrom.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
20 # http://cvs.infodrom.org/calendar/mail-calendar?cvsroot=infodrom
21 # :pserver:anonymous@cvs.infodrom.org:/var/cvs/infodrom co calendar/mail-calendar
26 # Important note: this program requires the FreeBSD version of
27 # calendar. The OpenBSD version uses incompatible commandline
28 # options and doesn't provide features used by this program.
31 opt_subject="Calendar for"
38 echo "mail-calendar [-h|--help] [-l|--lang locale] [-t|--to addr] [-a|--advance days]"
74 # Add support for non-english languages/locales
77 opt_subject="Kalender für den"
81 secs=$[ $opt_advance * 86400 ]
83 c_date=`date -d now+${secs}seconds +%d.%m`
84 s_date=`LANG=$opt_lang date -d now+${secs}seconds "+$opt_dateform"|iconv -f utf8 -t iso8859-1`
87 trap 'rm -f $tmp' INT EXIT
89 calendar -l 0 -w 0 -t $c_date|iconv -c -f utf8 -t iso8859-1 > $tmp
94 echo "Subject: $opt_subject $s_date"
96 echo "Content-Type: text/plain; charset=iso-8859-1"
97 echo "Content-Disposition: inline"
98 echo "Content-Transfer-Encoding: 8bit"
101 ) | /usr/sbin/sendmail "$opt_to"