home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / on-line / amicomsys / rexx / sendemail.amicomsys < prev    next >
Text File  |  1999-04-27  |  5KB  |  217 lines

  1. /* Send an Email-address to your mailer
  2.  Currently supported is YAM 1.3.x, YAM2p5, AirMailPro 3.2+, Eucalyptus, Iris and MicroDot2
  3.  This script is not able to contact any running copy of MicroDot2. Compose arexx command
  4.  is missing in it's arexx API.
  5.  $VER: SendEmail.amicomsys 1.1 (17.04.1999) Håkan Parting
  6. */
  7. parse arg tomail mailfile
  8. options results
  9.  
  10. /* Test the Arexx ports of supported mailers */
  11. /* YAM */
  12. if show('P','YAM') then
  13. do
  14.     ADDRESS YAM
  15.     SHOW
  16.     mailwrite
  17.     /* At last YAM2 started to support this obsolete tag again. YAM2 has WRITETO instead. */
  18.     /* How do I make this script compatible with YAM 1.3.x without using the old arexx commands? */
  19.     writemailto tomail
  20.     if mailfile~="" then do
  21.         writeletter mailfile
  22.     end
  23.     Exit
  24. end
  25.  
  26. /* AirMailPro */
  27. if show('P','AirMailPro') then
  28. do
  29.     ADDRESS 'AirMailPro'
  30.     AM_ComposeMail tomail
  31.     if mailfile~="" then do
  32.         AM_ImportText mailfile
  33.     end
  34.     Exit
  35. end
  36.  
  37. /* Eucalyptus 1.0 */
  38. if show('P','EUCALYPTUS.1') then
  39. do
  40.     ADDRESS EUCALYPTUS.1
  41.     if mailfile~="" then do
  42.         COMPOSE To tomail FILE mailfile
  43.         Exit
  44.     end
  45.     COMPOSE To tomail
  46.     
  47.     Exit
  48. end
  49.  
  50. /* Iris */
  51. if show('P','IRIS') then
  52. do
  53.     ADDRESS IRIS
  54.     NEWMSG TO tomail
  55.  
  56.     /* Include file not supported 990417 */
  57.     
  58.     Exit
  59. end
  60.  
  61. /* No mailer was found. Ask if we should start one! */
  62. ADDRESS AMICOMSYS
  63.  
  64. sbuttons="_YAM2|Y_AM1.3|A_irMailPro|_Eucalyptus|_MicroDot2|I_ris|_Cancel"
  65. yam=1
  66. yamold=2
  67. airmail=3
  68. microdot=5
  69. eucalyptus=4
  70. iris=6
  71.  
  72. REQUEST VAR mailer TITLE '"AmiComSys Query"' BUTTONS sbuttons TEXT '"None of the supported mailers were running. Which one to start?"'
  73.  
  74. /* YAM 2.0p5. The YAM executable must be available in the path YAM:. Which is normaly the case with YAM 2.0 */
  75. if mailer=yam then
  76. do
  77.     if exists('YAM:YAM')=0 then
  78.     do
  79.         REQUEST '"Error"' '"_Ok"' '"Could not find YAM 2.0 in the path YAM:YAM"'
  80.         EXIT
  81.     end
  82.  
  83.     ADDRESS COMMAND "RUN <>NIL: YAM:YAM NOCHECK"
  84.     i=0
  85.      do until show('P','YAM')>0 | i=3     /* Let's not wait more than 30 seconds */
  86.         ADDRESS COMMAND 'SYS:rexxc/WaitForPort YAM'
  87.         i=i+1
  88.       end /* do */
  89.       if show('P','YAM')=0 then exit
  90.  
  91.     /* Now YAM is running */
  92.     ADDRESS YAM
  93.     mailwrite
  94.     writemailto tomail
  95.     if mailfile~="" then do
  96.         writeletter mailfile
  97.     end
  98.     EXIT
  99. end
  100.  
  101. /* YAM 1.3.x. The YAM executable must be available in the path YAM: */
  102. if mailer=yamold then
  103. do
  104.     if exists('YAM:YAM')=0 then
  105.     do
  106.         REQUEST '"Error"' '"_Ok"' '"Could not find YAM 1.3.x in the path YAM:YAM"'
  107.         EXIT
  108.     end
  109.  
  110.     ADDRESS COMMAND "RUN <>NIL: YAM:YAM NOCHECK"
  111.     i=0
  112.      do until show('P','YAM')>0 | i=3     /* Let's not wait more than 30 seconds */
  113.         ADDRESS COMMAND 'SYS:rexxc/WaitForPort YAM'
  114.         i=i+1
  115.       end /* do */
  116.       if show('P','YAM')=0 then exit
  117.  
  118.     /* Now YAM is running */
  119.     ADDRESS YAM
  120.     mailwrite
  121.     writemailto tomail
  122.     if mailfile~="" then do
  123.         writeletter mailfile
  124.     end
  125.     EXIT
  126. end
  127.  
  128. /* AirMailPro. The AirMailPro v.3.2+ executable must be available in the path AirMail: */
  129. if mailer=airmail then
  130. do
  131.     if exists('AirMail:AirMailPro')=0 then
  132.     do
  133.         REQUEST '"Error"' '"_Ok"' '"Could not find AirMailPro in the path AirMail:AirMailPro"'
  134.         EXIT
  135.     end
  136.  
  137.     ADDRESS COMMAND "RUN <>NIL: AirMail:AirMailPro"
  138.     i=0
  139.      do until show('P','AirMailPro')>0 | i=3     /* Let's not wait more than 30 seconds */
  140.         ADDRESS COMMAND 'SYS:rexxc/WaitForPort AirMailPro'
  141.         i=i+1
  142.       end /* do */
  143.       if show('P','AirMailPro')=0 then exit
  144.  
  145.     /* Now AirMailPro is running */
  146.     ADDRESS 'AirMailPro'
  147.     AM_ComposeMail tomail
  148.     if mailfile~="" then do
  149.         AM_ImportText mailfile
  150.     end
  151.  
  152.     EXIT
  153. end
  154.  
  155. /* MicroDot 2. The MicroDot 2 executable must be available in the path MicroDot: */
  156. if mailer=microdot then
  157. do
  158.     if exists('MicroDot:MicroDot')=0 then
  159.     do
  160.         REQUEST '"Error"' '"_Ok"' '"Could not find MicroDot in the path MicroDot:MicroDot"'
  161.         EXIT
  162.     end
  163.  
  164.     if mailfile="" then do
  165.         ADDRESS COMMAND "RUN <>NIL: MicroDot:MicroDot To " tomail
  166.         EXIT
  167.     end
  168.     ADDRESS COMMAND "RUN <>NIL: MicroDot:MicroDot To " tomail " Contents " mailfile
  169.     EXIT
  170. end
  171.  
  172. /* Eucalyptus 1.0. The Eucalyptus executable must be available in the path Eucalyptus: */
  173. if mailer=eucalyptus then
  174. do
  175.     if exists('Eucalyptus:Eucalyptus')=0 then
  176.     do
  177.         REQUEST '"Error"' '"_Ok"' '"Could not find Eucalyptus in the path Eucalyptus:Eucalyptus"'
  178.         EXIT
  179.     end
  180.  
  181.     ADDRESS COMMAND "RUN <>NIL: Eucalyptus:Eucalyptus"
  182.  
  183.     i=0
  184.      do until show('P','EUCALYPTUS.1')>0 | i=3     /* Let's not wait more than 30 seconds */
  185.         ADDRESS COMMAND 'SYS:rexxc/WaitForPort EUCALYPTUS.1'
  186.         i=i+1
  187.       end /* do */
  188.       if show('P','EUCALYPTUS.1')=0 then exit
  189.  
  190.     ADDRESS EUCALYPTUS.1
  191.     if mailfile~="" then do
  192.         COMPOSE To tomail FILE mailfile
  193.         Exit
  194.     end
  195.     COMPOSE To tomail
  196.  
  197.     EXIT
  198. end
  199.  
  200. /* Iris. The Iris executable must be available in the path Iris: */
  201. if mailer=iris then
  202. do
  203.     if exists('Iris:Iris')=0 then
  204.     do
  205.         REQUEST '"Error"' '"_Ok"' '"Could not find Iris in the path Iris:Iris"'
  206.         EXIT
  207.     end
  208.  
  209.     ADDRESS COMMAND "RUN <>NIL: Iris:Iris MAILTO " tomail
  210.     
  211.     /* include file not supported by Iris */
  212.  
  213.     EXIT
  214. end
  215.  
  216. Exit
  217.