On Mon, Jan 15, 2001 at 09:39:23AM +0000, Viktor Lakics wrote:
> In the meantime I did some research and I think it is getting a little clearer
> to me. What I want is to ASK for read or delivery notification, and not ALLOW
> people to get this confirmation from me. I think those mutt variables I was
> referring to in my mail, are for setting what kind of receipt confirmation is
> possible to send BACKc automatically. As to ask for this to be sent to me in
> reply to my email, is up to some extra headers in my mail (like "
> Disposition-Notification-To: " or others).
> Obviously it would be a VERY BAD practice to insert them to my mails with
> my-hdrs in muttrc. I also realize that to get back the confirmation is up to
> that MTA on the other side (like sendmail). You are saying that postfix is not
> capable yet, so I guess I cannot send back such notifications.
> 
> But I think my original problem could be solved with just editing the mail
> headers and inserting those special ones. Is that right? If yes, how could I
> automate this? 

yes, with a macro

> 
> Basically how can I insert a specific extra header into my mail AFTER I saved
> my mail with my editor and BEFORE I sent it... And I don't mean pressing "e"
> and insert it manually :-)))

I don't know, but I think it could be possible

> 
> How could one write a macro to do that? Or to be able to do it mutt shoul be
> patched?
> 
> Viktor


There is my solution for notification (I posted it some month ago) :

- First, some ugly colors in the muttrc :

color header      brightred white "Disposition-Notification-To: *"
color header      brightred white "Return-Receipt-To: *"
color header      brightred white "X-Confirm-Reading-To: *"

- Second, the macro to switch notification on/off (change my adress to your adress ) :

macro index <F2> ":my_hdr Disposition-Notification-To: Antoine Martin 
<[EMAIL PROTECTED]>\n" "Toggle notification mode ON"
macro pager <F2> ":my_hdr Disposition-Notification-To: Antoine Martin 
<[EMAIL PROTECTED]>\n" "Toggle notification mode ON"

macro index \e<F2> ":unmy_hdr Disposition-Notification-To: *\n" "Toggle notification 
mode OFF"
macro pager \e<F2> ":unmy_hdr Disposition-Notification-To: *\n" "Toggle notification 
mode OFF"

- Third, the macro to SEND (Ctrl+V) a confirmation of reading :

macro pager \cv ":set weed=no ; set pipe_decode=yes\n|mail_notify.sh\n:set weed=yes; 
set pipe_decode=no\n" "Reading Notification"
macro index \cv ":set weed=no ; set pipe_decode=yes\n|mail_notify.sh\n:set weed=yes; 
set pipe_decode=no\n" "Reading Notification"

- Last : the mail_notify.sh (you need formail, given with procmail) :

-------- <SNIP> --------

#!/bin/sh

# Auteur:      Antoine Martin, stagiaire CDEI
# Date:        15 juin 2000
# usage:       cat <fichier_mail> | mail_notify.sh
# Description: envoie un accuse de reception a l'aide de mutt a partir d'un mail
#              contenant une demande d'accuse de reception
# Remarques:   normallement le BCC est inutile...

FILE=/tmp/mutt_notify.$$.$USER
formail | grep -v '^$' | grep -v ">From " > $FILE
NOTIFY_TO=`cat $FILE | formail -R Return-Receipt-To: Disposition-Notification-To: | 
formail -R X-Confirm-Reading-To: Disposition-Notification-To: | formail -x 
Disposition-Notification-To:`
if [ -n "$NOTIFY_TO" ] ; then
   echo "\nSending notification to$NOTIFY_TO"
   MESSAGE=/tmp/mutt_notify_message.$$.$USER
   REALNAME=`finger $USER | head -1 | awk -F: '{printf "%s",$3}'`
   TO=`formail -x To: < $FILE`
   CC=`formail -x Cc: < $FILE`
   BCC=`formail -x Bcc: < $FILE`
   SUBJECT=`formail -x Subject: < $FILE`
   REFERENCES=`formail -x References: < $FILE`
   MSGID=`formail -x Message-ID: < $FILE`
   DATE_SENDER=`formail -x Date: < $FILE`
   DATE_LOCALE=`date`
   REFERENCES=${REFERENCES}$MSGID
   echo "Your message sent on$DATE_SENDER\nTo :$TO" > $MESSAGE
   if [ -n "$CC" ] ; then
      echo "Cc to :$CC" >> $MESSAGE
   fi
   if [ -n "$BCC" ] ; then
      echo "Bcc to :$BCC" >> $MESSAGE
   fi
   echo "has been displayed on the screen of$REALNAME on $DATE_LOCALE" >> $MESSAGE
   cat $MESSAGE | mutt -e "my_hdr References:$REFERENCES" -s "NOTIFICATION 
OF:$SUBJECT" "$NOTIFY_TO"
   rm -f $MESSAGE
else
        echo "\nNo notification needed"
fi
sleep 1
rm -f $FILE


-------- </SNIP> --------

This is not perfect, but not useless :)

Good luck !

 Antoine

Reply via email to