home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / lan / pmail301.zip / UDG.ZIP / UDG.TXT < prev   
Text File  |  1993-08-30  |  19KB  |  427 lines

  1. ┌────────────────────────────────────────────────────────────┐
  2. │                                                            │
  3. │    Pegasus Mail v3.0 user-defined gateway reference.       │
  4. │    This document is part of the Pegasus Mail manual set    │
  5. │    and is provided as a courtesy to users of Pegasus       │
  6. │    Mail.                                                   │
  7. │                                                            │
  8. │    Copyright 1992-93, David Harris, All Rights Reserved.   │
  9. │                                                            │
  10. └────────────────────────────────────────────────────────────┘
  11.  
  12.  
  13. User-defined gateways
  14. ---------------------
  15.  
  16. Pegasus Mail version 2.25 and later incorporate a feature which 
  17. allows you to implement your own mail transport and have PMail 
  18. use it. The intention is that you will provide the mechanism 
  19. for moving the messages and  attachments from place to place, 
  20. while PMail does the preparation, formatting and filing for you.
  21.  
  22. Here are some possible gateways you could develop:
  23.  
  24. *    An implementation of uucp for dial-in Internet mail
  25.  
  26. *    A standalone gateway which communicates with a machine attached 
  27. to your LAN, allowing you access to all your LAN mail features 
  28. from a remote machine (such a gateway is currently under development 
  29. as part of the PMail system).
  30.  
  31. *    A custom system which takes LAN mail and transfers it via some 
  32. file transfer protocol to a mainframe.
  33.  
  34. *    A gateway to a facsimile server.
  35.  
  36. The possibilities are limited only by your imagination.
  37.  
  38.  
  39. The gateway process.
  40. -------------------
  41.  
  42. While PMail offers considerable flexibility in the way it can 
  43. interact with your gateway, be aware that creating a gateway 
  44. will almost certainly involve a small amount of programming - 
  45. typically, you will need to write the program which PMail runs 
  46. to deliver and receive mail. You can do this programming in any 
  47. language which produces a program which could be run from DOS: 
  48. Pegasus Mail is written in C, but you could easily write your 
  49. gateway process in Pascal, Modula-II or even in Basic (God forbid!). 
  50. PMail invokes your gateway process when sending mail, or to check 
  51. for new mail. In most cases, your gateway process must not write 
  52. to the screen.
  53.  
  54. Note: you can use MS-DOS batch files as gateway processes.
  55.  
  56. What the gateway process does, and how you should do it is not 
  57. covered in this manual - this is your part of the project, and 
  58. you'll have to design it to your own specification. As a help, 
  59. however, the last section of this document describes how we interfaced 
  60. PMail with Waffle, a popular BBS and UUCP program.
  61.  
  62.  
  63. How PMail uses a UDG
  64. --------------------
  65.  
  66. You have to provide PMail with a set of instructions which it 
  67. uses to interface to your gateway. You do this using PMail's 
  68. PCONFIG program, choosing "create a User-defined gateway". The 
  69. gateway definition screen is essentially a form - you merely 
  70. have to fill in the appropriate details for your gateway.
  71.  
  72.  
  73. Command substitution
  74. --------------------
  75.  
  76. Most of the entries in this screen which accept strings allow 
  77. you to use special command substitution characters in the strings: 
  78. these are like "escape sequences" which will cause PMail to perform 
  79. some substitution at run-time. Command substitutions always begin 
  80. with a tilde (~) character, and are always two characters long. 
  81. The following command substitutions are recognised:
  82.  
  83.    This sequence...   Is replaced with this value
  84.  
  85.    ~c       The full path to the file containing the message
  86.    ~t       The address to which to send this message
  87.             (note: this is not necessarily the To: field)
  88.    ~s       The message's subject field
  89.    ~f       The full form of the message's "from" field
  90.    ~n       The sender's user name in its simplest form
  91.    ~b       The sender's bindery id, as a long hex integer
  92.    ~8       The first 8 chars in the sender's username
  93.    ~y       The time and date in RFC-822 format
  94.    ~d       A random integer, expressed as 4 hex digits
  95.    ~q       Y if this message is a BCC, N otherwise
  96.    ~%name%  The value of the environment variable %name%.
  97.    ~p       The user's personal name preference
  98.    ~x       The name.ext ONLY of the container file (no path)
  99.    ~a       The directory from which PMail was run (or base directory)
  100.    ~h       The current user's home mailbox location
  101.    ~~       A single tilde character.
  102.  
  103. Example: Assume that you have defined the gateway output command
  104.  
  105.    mygate ~c ~8 sys:mail/~b
  106.  
  107. And a user called DAVID, whose bindery ID is 4000001 sends a 
  108. message which PMail stores in c:\temp\119944.tmp. When PMail 
  109. invokes your gateway, the command line will be as follows:
  110.  
  111.       mygate c:\temp\119944.tmp DAVID sys:mail/4000001
  112.  
  113. In the following description of the Gateway Definition screen, 
  114. fields marked with an * will support command substitution. Command 
  115. substitution is also possible in the "Home mailbox" and "New 
  116. mailbox" fields of PMail's standalone configuration screen.
  117.  
  118.  
  119. Gateway definition fields
  120. -------------------------
  121.  
  122. Gateway name:  This is the name by which users will know this 
  123. gateway. It should follow legal NetWare naming rules, and cannot 
  124. contain spaces.
  125.  
  126. Users will access the gateway using NetWare usercode syntax so, 
  127. say you call your gateway HONG_KONG, and a user wants to mail 
  128. to someone called J_JONES at the gateway, they would enter the 
  129. address as HONG_KONG/J_JONES.
  130.  
  131. *New mail path:  This is either a full path to a location where 
  132. PMail is to find new mail, or else the name of a program to run 
  133. when checking for new mail. You can use command substitution 
  134. in this string to construct complex paths.  note that PMail will 
  135. assume that ALL mail matching the search mask is for the current 
  136. user - it will not parse messages to determine the recipient. 
  137. If your transport places new mail in the mail directory each 
  138. user has in SYS:MAIL, using a .CNM file extension, then you do 
  139. not need to enter anything in this field. Note that if you have 
  140. a gateway which writes messages into the user's NetWare directory 
  141. in SYS:MAIL using an extension other than .CNM, you can enter 
  142. a search path here using this command substitution: SYS:MAIL/~b 
  143. (See the section on command substitutions for more on this).
  144.  
  145. Is ^ a program to run?  Enter 'Y' if "New mail path" is a program 
  146.  name rather than a directory name. Gateways which require a 
  147. program  to be run to retrieve new mail will not be polled periodically 
  148. - rather, the "check for New mail" option will remain permanently 
  149. on the main menu, and the program can only be run when that option 
  150. is selected.
  151.  
  152. *New mail search mask:  This is a DOS filename pattern which 
  153. PMail is to use when searching the New mail path for new mail. 
  154. New mail messages will be rewritten in the user's home mailbox 
  155. using the normal PMail naming convention prior to reading, but 
  156. they need not be in this format as written by the gateway.
  157.  
  158. *Outgoing mail path:  The name of the directory in which PMail 
  159. should create outgoing mail messages. Again, command substitution 
  160. (described above) can be used in this string for specialised 
  161. processing.
  162.  
  163. *Run for outgoing mail:  If you enter a program name in this 
  164. field,  PMail will run it every time it sends new mail to the 
  165. gateway. The program must leave  the screen in the condition 
  166. it found it (ie, if it writes to the screen, it must do so using 
  167. non-destructive windows). This field is the one which will normally 
  168. benefit the most from the use of command substitution (see above). 
  169. By embedding escape keys in this string, you can construct extremely 
  170. complex command lines. Usually, this field will refer to a "glue" 
  171. program you have written to interface with the gateway: the actual 
  172. invocation of the gateway is intended to be user-activated via 
  173. choices in the SENDER.PM file.
  174.  
  175. *Filename format:  This field allows you some control over the 
  176. filenames PMail will use when creating outgoing messages. The 
  177. ~d command substitution (random integer value) is often very 
  178. useful in this field.
  179.  
  180. Run to validate address:  You can provide a program which PMail 
  181. will call to validate that an address is correct. If you do so, 
  182. enter it in this field. Unlike other command strings, command 
  183. substitution is not possible with this field  the only parameter 
  184. passed on the  command line is the address to validate. Your 
  185. program must not disturb the screen, and must return 0 if the 
  186. address is invalid, or non-zero if the address is OK.  If nothing 
  187. is entered in this field, no attempt will be made to validate 
  188. addresses.
  189.  
  190. *Reply address format:  This field allows you control how PMail 
  191. will construct the "From" address in outgoing messages. You can 
  192. use command substitution in this field.  
  193.  
  194.    Example: entering ~8@home.otago.ac.nz (~p)
  195.    will cause the from field of messages from user david to read 
  196.    david@home.otago.ac.nz (David Harris).
  197.  
  198. Accepts SMTP addresses:  If your gateway accepts messages using 
  199. standard internet address formats, set this flag to 'Y'. If Charon 
  200. is not installed on your system and a user enters a standard 
  201. internet address, PMail will examine all available gateways, 
  202. and will pass the message to the first with this flag set. This 
  203. allows users to send internet mail using normal addressing, rather 
  204. than having to send it specifically via a gateway using the SERVER/ADDRESS 
  205. format.
  206.  
  207. Simple message headers:  PMail can write messages with extra 
  208. preparsed address information at the beginning of the message in
  209. either of two formats:
  210.  
  211. 1: Simple message headers is the original form provided by PMail.
  212.    It is not particularly effective and is only provided for
  213.    backwards compatibility.
  214.  
  215.    The simple header information is line-based, using line number
  216.    as a key. Gateways which read simple message headers must read
  217.    until a totally blank line is encountered, then send the remainder
  218.    of the message, which will be normally formatted. At present, two
  219.    lines are defined in the simple headers, although others may
  220.    be added in future:
  221.  
  222.     * Line 1: The recipient of this message (not the same as
  223.       the To: field)
  224.     * Line 2: Contains 'Y' if this message has attachments.
  225.  
  226.    Lines without values will contain a single space. Addresses are 
  227.    already parsed. Since the format is intended to be extensible, 
  228.    gateways which understand simple headers must ignore lines they 
  229.    are not written to use, and must read until the blank line.
  230.  
  231. 2: 'Glue' headers are an extension of simple headers; they are
  232.    essentially a variant of the format PMail uses for Charon and
  233.    Mercury with a little more information. The first line of the
  234.    message is the signature "$$ " followed by the "from" address
  235.    of the sender. Each subsequent line lists all the addressees
  236.    to which this message should be sent, with a single character
  237.    code at the start of the line indicating whether the address
  238.    is for someone in the "to" field (T), the CC field (C) or the
  239.    BCC field (B). The code is followed by exactly one space then
  240.    the address. The glue headers end with a blank line and are
  241.    followed by the message in canonical RFC822 format. Gateways
  242.    designed to work with glue headers MUST IGNORE a line which
  243.    starts with an unrecognized code character: this allows the
  244.    format to grow. The PMPOP POP3 gateway for PMail v3.0 expects
  245.    to see messages in glue header format.
  246.  
  247. UUencode attachments:  If 'Y', then PMail will generate a separate 
  248. message for each attachment, and will uuencode the attachment 
  249. into the message. If 'N', a file with the same name as the message 
  250. but the extension '.ATT' will be written into the outgoing mail 
  251. directory, along with the attachments. The .ATT file will contain 
  252. the names of the attachments to the message, one per line.
  253.  
  254.    (PMail currently ONLY supports uuencoded attachments).
  255.  
  256. Burst messages?  If 'Y', then PMail will create one message for 
  257. every address sent to: it is up to your gateway process to use 
  258. the ~t command substitution to ensure that delivery is correct, 
  259. since you generally will not be able to tell from the message's 
  260. headers who a particular copy should be sent to. If 'N', PMail 
  261. assumes that your gateway can parse the message for address data, 
  262. and will write all the addresses into one message, using standard 
  263. RFC-822 folding and header rules. The exception to this is messages 
  264. with a BCC header: this will generate two envelopes, one with 
  265. the BCC field, the other without. Your process can determine 
  266. which is the BCC delivery using the ~q command substitution.
  267.  
  268. Force all mail through:  If you set this field to 'Y', then PMail
  269. will pass all mail irrespective of addressing to the gateway for
  270. processing. This effectively disables PMail's support for all other
  271. transports in the system.
  272.  
  273.  
  274. Gateways and BCC:
  275. ----------------
  276.  
  277. Messages with BCC (Blind Carbon Copy) recipients present special 
  278. problems to gateways, since the same message ends up being processed 
  279. twice - once with no BCC header, then again as a separate job 
  280. containing the BCC header. PMail can indicate to the gateway 
  281. process that a message needs BCC processing (using the ~q command 
  282. substitution), but it is up to the gateway process to ensure 
  283. that the BCC field is properly handled, and that the message 
  284. is correctly forwarded. If your gateway does not handle BCC as 
  285. a special case, we recommend that you do NOT use BCC fields.
  286.  
  287.  
  288. Altering the Main menu - PMail 3.0 and later
  289. --------------------------------------------
  290.  
  291. Under PMail 3.0 and later, options are added to the "Send Message"
  292. and "Check New mail" menu items via a resource file called
  293. PM-MENU.RSC. A heavily-commented sample for this file is provided
  294. with the PMail 3.0 distribution - please examine it for further
  295. details.
  296.  
  297.  
  298. Altering the Main menu - PMail 2.35 and earlier
  299. -----------------------------------------------
  300.  
  301. Pegasus Mail v2.35 and earlier allow you to add sub-choices to 
  302. two of the options on the main menu- "Check for New mail" and 
  303. "Send a mail message". The addition is done via a text file called 
  304. SENDER.PM, which must be stored in the same directory as PMAIL.EXE. 
  305. This file contains sets of 5 lines, each set defining one sub-choice. 
  306. Blank lines and lines beginning with a semi-colon (';') are treated 
  307. as comments and are ignored. The lines within each set have the 
  308. following meanings:
  309.  
  310. *    Line 1: Either N if this entry is to be added to the New Mail 
  311. submenu, or S if it is for the Send message submenu.
  312.  
  313. *    Line 2: The text to show in the submenu
  314.  
  315. *    Line 3: Pegasus Mail will create a temporary filename which 
  316. can be passed to the command you specify on the command line. 
  317. If this field is Y, then PMail will look for the file when the 
  318. command returns: if the file exists and is longer than 0 bytes, 
  319. PMail will parse it as a message and mail it normally. This allows 
  320. you to create alternative message entry screens. Note that if 
  321. you use this option, the file must contain a properly-formatted 
  322. RFC-822 message on return. Attachments cannot currently be specified 
  323. in this file.
  324.  
  325. *    Line 4: Enter Y on this line if PMail should save its screen 
  326. before invoking the command, and restore it when the command 
  327. returns. If N, then PMail assumes that the command either does 
  328. no screen output, or that it does it non-destructively.
  329.  
  330. *    Line 5: Enter the command PMail should invoke on this line. 
  331. All command substitutions (see above) are possible here. The 
  332. maximum length of an entry on this line is 80 characters, although 
  333. the command line may be up to 128 characters in length after 
  334. command substitution. To invoke the usual built-in function (ie, 
  335. either Check for New Mail or Send a Message), enter a single 
  336. colon (':') on this line. The command you enter here may be an 
  337. MS-DOS batch file or an executable image.
  338.  
  339.  
  340. A Sample Implementation - PMail and Waffle.
  341. -------------------------------------------
  342.  
  343. Waffle is a particularly good Bulletin-Board System which is 
  344. widely distributed as Shareware on the Internet and on numerous 
  345. public services. Among its features is a solid implementation 
  346. of uucico, the UNIX copy-in - copy-out routine used to make uucp 
  347. transfers. Remember that Waffle is a Shareware program: we urge 
  348. you to send in the shareware license for Waffle if you use any 
  349. part of it - the program is well worth it, and the author deserves 
  350. support.
  351.  
  352. PMail can be quite easily interfaced with Waffle, providing a 
  353. quite functional standalone mail facility via uucp. One small 
  354. "glue" program is required - the source for this is included 
  355. on the PMail distribution diskette as an example of how gateways 
  356. can be implemented. The glue program was written by Brendan Murray, 
  357. Systems Manager at the University of Otago. Brendan has kindly 
  358. made the source freely available and modifiable without charge 
  359. or restriction. Both the glue code and this example assume that 
  360. you have a properly-configured copy of Waffle on your system.
  361.  
  362. Essentially, PMail creates a temporary file, then passes it to 
  363. the glue program, using a number of command substitutions to 
  364. minimise the parsing the program has to do. The glue code then 
  365. parses Waffle's static configuration file and creates appropriate 
  366. mail files in the right place for uucico and uuxqt. Two options 
  367. are added to the main menu to allow the user to choose when to 
  368. invoke uucico to process outgoing mail, and receive incoming 
  369. mail.
  370.  
  371. A sample user-defined gateway definition for Waffle is as follows:
  372.  
  373. Gateway name:              WAFFLE
  374. New mail path:             c:\mailbox\~8
  375. Is ^ a program to run?:    N
  376. New mail search mask:      ~8.*
  377. Outgoing mail path:        c:\scratch\tmp
  378. Run for outgoing mail:     c:\bin\filter ~n ~c ~t ~y
  379. Filename format:           ~d~d.WOM
  380. Run to validate address:    
  381. Reply address format:      ~8@myhost.domain
  382. Accepts SMTP addresses?:   Y
  383. Simple message headers?:   N
  384. UUencode attachments?:     Y
  385. Burst messages?:           Y
  386. Strip GW name?:            Y
  387. Check new mail every x seconds.
  388.  
  389.  
  390. Brendan's filter program locates Waffle's configuration file 
  391. using the WAFFLE environment variable; it expects parameters 
  392. on the command-line in the following order:
  393.  
  394.    1:    The name of the user sending the message
  395.    2:    The name of the message container file
  396.    3:    The To: field of the message
  397.    4:    The time and date as an RFC-822 string
  398.  
  399.  
  400.  
  401. The SENDER.PM file for PMail using Waffle is as follows:
  402.  
  403. S
  404. Regular mail message
  405. N
  406. N
  407. :
  408.  
  409. S
  410. Send all outgoing mail
  411. N
  412. Y
  413. uucico
  414.  
  415. N
  416. Read new mail messages
  417. N
  418. N
  419. :
  420.  
  421. N
  422. Check host for new mail
  423. N
  424. Y
  425. uucico
  426.  
  427.