home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / shuff110.zip / BOUNCE.CMD next >
OS/2 REXX Batch file  |  1993-11-02  |  2KB  |  45 lines

  1. /*  Bounce.Cmd -- A REXX Script to bounce errant email  */
  2. /*                  in conjunction with IBM SENDMAIL  */
  3.  
  4. '@ECHO OFF'
  5. parse arg all_args
  6. if ((word(all_args,1)='/H') | (word(all_args,1)='/h')) then do 1
  7.   say 'Bounce.Cmd -  "bounces" email back to sender.'
  8.   say ''
  9.   say '    BOUNCE  messagefile  host-address  return-to-address [ChildID#]'
  10.   say ''
  11.   return
  12. end  /* Do */
  13. MailerName = 'Mailer-Daemon'
  14. MessageFile = word(all_args,1)
  15. HostAddr = word(all_args,2)
  16. ReturnToAddr = word(all_args,3)
  17. ChildID = word(all_args, 4)
  18. if ChildID='' then ChildID='Bounce'
  19. ToBeMailed = ChildID'.Tmp'
  20. if MessageFile = '' then return
  21. if HostAddr = '' then return
  22. if ReturnToAddr = '' then return
  23.  
  24. CALL RxFuncAdd 'SysFileSearch', 'RexxUtil', 'SysFileSearch'
  25. CALL SysFileSearch MailerName, MessageFile, HIts
  26. if Hits.0>0 then return
  27.  
  28. 'IF EXIST 'ToBeMailed' DEL 'ToBeMailed
  29. CALL LINEOUT ToBeMailed, , 1
  30. CALL LINEOUT ToBeMailed,'To: 'ReturnToAddr
  31. CALL LINEOUT ToBeMailed, ''
  32. CALL LINEOUT ToBeMailed, 'Ye Olde Mailer-Daemon@'HostAddr' hath determined that '
  33. CALL LINEOUT ToBeMailed, ' your message hath been incorrectly addressed to a userid'
  34. CALL LINEOUT ToBeMailed, '  that doth not exist.'
  35. CALL LINEOUT ToBeMailed, ''
  36. CALL LINEOUT ToBeMailed, 'Said undeliverable message is hereby returned unto your attention.'
  37. CALL LINEOUT ToBeMailed, '----------------------------------------------------------------------'
  38. CALL LINEOUT ToBeMailed
  39. 'TYPE 'MessageFile' >>'ToBeMailed
  40. 'DEL 'MessageFile
  41.  
  42. 'SENDMAIL -af 'ToBeMailed' -f 'MailerName' 'ReturnToAddr
  43.  
  44. 'DEL 'ToBeMailed
  45.