[Techtalk] email via memory stick?
Michelle Konzack
linux4michelle at freenet.de
Mon Jan 7 12:01:36 UTC 2008
Hi Ian,
I am using mutt and created a sendmail-wraper so I can sign and send
messages without any changements...
The messages are stored then in a folder ~/Maildir/.POSTPONED/ and
my laptop sends it as is, automaticaly from a script with
----8<------------------------------------------------------------------
#!/bin/bash
while [ -z "$(ping -c 1 mx.freenet.de 2>/dev/null)" ] ; do
sleep 15
done
for MSG1 in ${HOME}/Maildir/.POSTPONED/new/* ; do
cat ${MSG1} |ssmtp -au linux4michelle at freenet.de -ap my_secret -t
if [ $? -eq 0 ] ; then
MSG2=$(echo ${MSG1} |sed 's|/.POSTPONED/new/|/.POSTPONED/cur/|')
mv ${MSG1} ${MSG2}
fi
done
----8<------------------------------------------------------------------
This script check all 15 seconds whether the Mailserver <mx.freenet.de>
is there and if yes, it proceed all messages. If the message is
successfuly send it move the mesage from the /new/ subdir to the /cur/
subdir of the folder...
Attached a little bit more complex script which I use for several years
which is run all 5 minutes from my private crontab.
Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSN LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
-------------- next part --------------
#!/bin/bash
LOGDATE=${HOME}/Maildir/.POSTPONED/$(date +%Y%m%d).log
if [ -n "$(ls ${HOME}/Maildir/.POSTPONED/new/*)" ] ; then
if ping -c 1 mx.freenet.de ; then
COUNT=1
for MSG in ${HOME}/Maildir/.POSTPONED/new/* ; do
if [ -z "$(echo "${MSG}" |grep ',S$')" ] ; then
# RFC822=$(date -r ${MSG} --rfc-822)
RFC822=$(date --rfc-822)
SUB=$(cat ${MSG} |formail -czx Subject: |cut -c 1-70)
DIR=$(cat ${MSG} |formail -c -x X-Mutt-Fcc: |sed -e "s,\ ,,g;s,=,${HOME}/Maildir/,;s,/$,,")
if [ -z "$(cat ${MSG} |formail -czx Date:)" ] ; then
cat ${MSG} |\
formail -f -I X-Mutt-Fcc: -I Status: \
-a "Date: ${RFC822}" \
-a Message-ID: >${MSG}:2,S
else
cat ${MSG} |\
formail -f -I X-Mutt-Fcc: -I Status: \
-a Message-ID: >${MSG}:2,S
fi
echo "###############################################################################" >>${LOGDATE}
echo "##################### NEW MESSAGE AT `date '+%Y-%m-%d %H:%M:%S'` #####################" >>${LOGDATE}
echo "Message: ${SUB}" >>${LOGDATE}
echo "${COUNT} : ${SUB}" |cut -c 1-79
cat ${MSG}:2,S |ssmtp -t -au XXXXXXXXXXX at freenet.de -ap XXXXXXXXXXX >>${LOGDATE} 2>&1
if [ $? -eq 0 ] ; then
if [ -z "${DIR}" ] ; then DIR="${HOME}/Maildir/.Sent" ; fi
mkdir -p ${DIR}/{tmp,new,cur}
mv -f ${MSG}:2,S ${DIR}/cur/
rm -f ${MSG}
echo "Message: OK." >>${LOGDATE}
NP=$(echo ${DIR} |sed s,${HOME}/Maildir/,,)
echo "Path: ${NP}/cur/$(basename ${MSG}):2,S" >>${LOGDATE}
else
rm -f ${MSG}:2,S
echo "Message: Failed." >>${LOGDATE}
NP=$(echo ${MSG} |sed s,${HOME}/Maildir/,,)
echo "Path: ${NP}" >>${LOGDATE}
fi
COUNT=$((COUNT+1))
fi
done
else
echo "###################### NO NETWORK AT `date '+%Y-%m-%d %H:%M:%S'` ######################" >>${LOGDATE}
fi
fi
More information about the Techtalk
mailing list