home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / IMPRO / INETMAIL.ZIP / group.cmd < prev    next >
OS/2 REXX Batch file  |  1997-02-12  |  1KB  |  58 lines

  1. /* rexx */
  2.  
  3. /* 
  4.  * This rexx script will resend the mail message it receives to the
  5.  * group name.
  6.  *
  7.  */
  8.  
  9. Env = 'OS2ENVIRONMENT'
  10. Mailer = 'hmailer.exe'
  11. /* replace the domain with your domain, some systems require a */
  12. /* valid address for this in order to accept mail */
  13. GroupDaemon = 'postmaster@example.com'
  14.  
  15. /* The external functions we need */
  16. call RxFuncAdd 'SysTempFileName', 'RexxUtil', 'SysTempFileName'
  17. call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
  18. call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
  19.  
  20. parse arg GroupName MsgFile
  21. parse var GroupName GroupName '@' Domain
  22.  
  23. /* Find out where the group files should be */
  24. /* 
  25.  * By changing the environment variable used for this, the
  26.  * group files can be moved to any directory. The default is
  27.  * the MAILD directory.
  28.  *
  29.  */
  30. GroupDir = value('MAILD',,Env)
  31.  
  32. /* Change to the group directory */
  33. Junk = directory(GroupDir)
  34.  
  35. /* Build the group filename */
  36. GroupFile = GroupDir'\'GroupName
  37. /* Make sure it exists */
  38. rc = SysFileTree(GroupFile, s., 'F')
  39. if rc != 0 & s.0 != 1 then
  40.   do
  41.   say 'Group file not found. Deleting message file.'
  42.   rc = SysFileDelete(MsgFile)
  43.   exit
  44.   end
  45.  
  46. /* Temporary file for group names */
  47. NameFile = SysTempFileName('?????.tmp', '?')
  48.  
  49. /* Copy it */
  50. call CopyLock(GroupFile NameFile)
  51.  
  52. /* Mail it */
  53. Mailer GroupDaemon NameFile MsgFile
  54.  
  55. exit
  56.  
  57.  
  58.