home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma62.dms / ma62.adf / Voyager10 / Rexx / MailTo-YAM.VRX < prev   
Text File  |  1996-05-03  |  3KB  |  101 lines

  1. /* MailTo-YAM.VRX by Michel 'Bitstorm' Labbé <mlabbe@quebectel.com>
  2. ** $VER: MailTo-YAM v1.06 (29.04.96)
  3. **
  4. ** This is a very simple script designed for use with Voyager's new mailto:
  5. ** support.
  6. **
  7. ** Thanks to Mike Fitzgerald for the original script
  8. ** Credits also goes to: DFDuck for helping me with ARexx programming
  9. **                       Phideaux for early betatesting
  10. **                       Olli for writing very nice softwares such as V
  11. **
  12. ** Set Voyager's mailto: string as follow
  13. ** mailto: App [RX Rexx/MailTo-YAM.VRX "%h"]
  14. **
  15. ** Now change the variables below to whatever fits for your setup.
  16. **
  17. ** Notes: YAM must be running for the script to work
  18. **        To pop CED on V's Pubscreen, you need the GetPubScreen command
  19. **
  20. **
  21. ** Known bug(s):
  22. ** The script won't send the mail if YAM wasn't already running when you
  23. ** started the script and you have "Get mail on startup" turned on.  To
  24. ** fix this, turn off that flag in YAM's configs.
  25. **
  26. */
  27.  
  28. AddSignature = 'Yes'                    /* use YAM's signature        */
  29. PopOnVScreen = 'Yes'                    /* pop CED on V's pubscreen    */
  30. Editor       = 'CED'                    /* path/name of the editor    */
  31. Subject      = 'Message from your URL'    /* subject for the message    */
  32. YAMPath      = 'YAM:'                    /* must end with : or /        */
  33.  
  34. parse arg mailto
  35.  
  36. /* check for the presence of Libs:rexxsupport.library */
  37.  
  38. if ~show('L','rexxsupport.library') then do
  39.     if addlib('rexxsupport.library',0,-30,0) then nop
  40.     else do
  41.         call showerror('This script needs the rexxsupport.library to work properly.  This file can be found on your original Workbench 2+ disks and should be placed in Libs:')
  42.         exit 20
  43.     end
  44. end
  45.     
  46. /* add YAM's signature if YAM:.signature file exists */
  47.  
  48. if(upper(AddSignature) = 'YES') then do
  49.     if exists(YAMPath'.signature') then
  50.         shell command 'copy 'YAMPath'.signature t:mail'
  51.     else
  52.         do    call showerror('No signature file found! Please correct this in YAM or turn off signature adding in MailTo-YAM.VRX<BR>You should also check the YAMPath in MailTo-YAM.VRX')
  53.             exit 20
  54.         end
  55. end
  56.  
  57.  
  58. /* send the mail from YAM */
  59.  
  60. call pragma('stack',10000)
  61.  
  62. if upper(PopOnVScreen) = 'YES' then
  63.     address command (editor' -keepio -pubscreen=`getpubscreen` t:mail')
  64. else address command (editor' -keepio t:mail')
  65.  
  66. /* look for YAM process */
  67. if ~show('P','YAM') then do
  68.     shell command 'Run <>NIL: YAM:YAM'
  69.     do until show('P','YAM')
  70.         call delay(50)  /* needs rexxsupport.library */
  71.     end
  72. end
  73.  
  74. address YAM
  75. WriteMailTo mailto
  76. 'WriteSubject "'Subject'"'
  77. WriteLetter 'T:Mail'
  78. WriteQueue
  79. MailSendAll
  80. call delete('t:mail')  (rexxsupport.library)
  81.  
  82. EXIT
  83.  
  84. /* sophisticated errorhandling (ripped from MailTo-THOR.VRX) :-) */
  85.  
  86. showerror:
  87.     parse arg errormsg
  88.  
  89.     p=show('P',,)
  90.     if(pos('MINDWALKER', p) > 0) then vport = word(substr(p, pos('MINDWALKER', p)), 1)
  91.     else return
  92.  
  93.     call open(err, "T:MailTo-YAM.error.html", W)
  94.     call writeln(err, "<HTML><HEAD><TITLE>MailTo-YAM.VRX encountered an error</TITLE></HEAD><BODY><H1>Sending mail aborted</H1>" || errormsg || ".")
  95.     call close(err)
  96.  
  97.     address(vport)
  98.     'openURL file://localhost/T:MailTo-YAM.error.html'
  99.  
  100.     return
  101.