[comp.mail.sendmail] Ultrix 3.1,SMTP problem in DECnet mailer

avolio@decuac.dec.com (Frederick M. Avolio) (11/12/89)

I believe this probably has to do with a bug in VMS Mail which gets upset with
long address (To: ) lines.

Check it out.   If so, submit an SPR for VMS Mail.

Fred

elsen@esat.kuleuven.ac.be (11/23/89)

  Sometime ago I posted a question related to mails getting stuck in
'/usr/spool/mqueue' with a 'Lost Connection to remote node while 
Confirming delivery status' ; these mails were due for final delivery
on VMS hosts using SMTP DECnet mail between VMS and Ultrix

Several people responded indicating that this is caused by the fact that
VMS mail cannot handle To lines in excess of 511 bytes.

At our site we wrote a script to handle this.It processes each mail
in /usr/spool/mqueue looks at the status and corrects the queue file
(making the original To line smaller) if needed.
This script runs each day from Cron.

The original To line is then appended to the body of the mail message
so that the end user can still see the original to line.

I guess this would be useful for any of you managing an Ultrix system
being a front end for mail between VMS hosts and the outside
world so I am posting it here.
Thanks to all of you whom responded to my original question.



-----------------------------------cut here-------------------------------------
#!/bin/csh
#
#  Script inorder to process mails to DECnet which got deferred
#  with a status as in 'Lost connection to remote node while 
#  confirming delivery'
#  Caused by a bug in mail11 on behalf of the VMS side which doesn't
#  accept To: (From,CC,Subject...)  lines  longer then 511 bytes.
#
#
#       Update Logfile (/usr/adm/princess.log)
#
/bin/rm /usr/adm/princess.log.7
/bin/mv /usr/adm/princess.log.6  /usr/adm/princess.log.7
/bin/mv /usr/adm/princess.log.5  /usr/adm/princess.log.6
/bin/mv /usr/adm/princess.log.4  /usr/adm/princess.log.5
/bin/mv /usr/adm/princess.log.3  /usr/adm/princess.log.4
/bin/mv /usr/adm/princess.log.2  /usr/adm/princess.log.3
/bin/mv /usr/adm/princess.log.1  /usr/adm/princess.log.2
/bin/mv /usr/adm/princess.log.0  /usr/adm/princess.log.1
/bin/mv /usr/adm/princess.log    /usr/adm/princess.log.0
/bin/cp /dev/null              /usr/adm/princess.log
/bin/chmod 664                /usr/adm/princess.log
#
#
#
set message="Lost connection to remote node while confirming delivery"
#
# Process each control file in the spool directory
#
# Next line is site specific !!
cd /usr/spool/mqueue
#
#
set logfile = /usr/adm/princess.log
foreach qfile (qf*)
#
    set lfile=`echo $qfile | sed -n "s/^q/l/p"`
#
#          Check for 'message'
#
    grep "$message" $qfile > /dev/null
    if ($status == 0 ) then
#
#       if lockfile present don't touch it!
#
        if (! -e $lfile) then 
#
#            Create Lock file to keep sendmail from processing this mail
#            while we are busy
#
            cp /dev/null $lfile
#
#           Set dfile = name of corresponding data file (message body)
#           Set recipient = name of mail destination
#           Set sender    = name of sender
#
            set dfile=`sed -n "s/^D//p" $qfile`
            set recipient=`sed -n "s/^R//p" $qfile`
            set sender=`sed -n "s/^S//p" $qfile`
            echo `date` $qfile  >>! $logfile
            echo "From:" $sender >>! $logfile
            echo "To:" " " $recipient >>! $logfile
	    echo "-----------------------------------" >>! $logfile
#
#           Insert Dummy header at the end of the queue file to simplify
#           sed addressing through regular expressions in qfile
#
            echo "Hdummyheader" >> $qfile
#
#           Append To header in qfile to dfile 
#
            echo "------------" >> $dfile
            echo "Original-To: " >> $dfile
#
#
# The next line is site specific !!
            echo "These lines were written by esat.kuleuven.ac.be to permit 
delivery on VMS hosts." >> $dfile
#
            sed -n "/^HTo:/,/^H/p" $qfile | sed -e "s/^HTo:/       /" -e '$d' 
>> $dfile
#
#           Modify To line in control file
#
            set headlen=`sed -n "/^HTo:/=" $qfile `
            set tolen=`sed -n "/^HTo:/,/^H/p" $qfile | wc -l `
            set filelen=`wc -l < $qfile`
            @ headlen--
	    @ tolen--
            @ taillen = $filelen - $headlen
            @ taillen -= $tolen
            set tempfile = tmp$$
#
            head -$headlen $qfile > $tempfile
            echo "HTo:" $recipient  >> $tempfile
            tail -$taillen $qfile >> $tempfile
#
            sed '$d' $tempfile >! $qfile
            /bin/rm $tempfile
#
#              Delete Lock file
#
            /bin/rm -f $lfile
        endif
    endif
#
end
--------------------------------------cut here----------------------------------
-- 


  Marc Elsen (System Manager/Software Engineer)
  Katholieke Universiteit Leuven
  Dep. E.S.A.T.
  Kard. Mercierlaan 94
  3030 HEVERLEE
  Belgium
              tel. 32(0)16220931(ext. 1080)

               EMAIL : elsen@esat.kuleuven.ac.be

                       ...!kulcs!kulesat!elsen (UUCP)
                       elsen%kulesat.uucp@blekul60 (BITNET)
                       psi%02062166012::elsen  (PSI MAIL)