home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / COMMS / PSIONMAI / PSIONMAI.TXT < prev    next >
Encoding:
Text File  |  1995-07-13  |  23.7 KB  |  561 lines

  1. Psionmail a suite of programs program to transfer, off-line read and return 
  2. SMTP email between Psion seies3 and Sun machines
  3.  
  4. Written by Tim Graves (tim.graves@uk.sun.com), This document version is time stamped 11 
  5. July 1995 6:59 pm
  6.  
  7.  
  8.  
  9. NOTE: This program is provided AS IS, no warrantee of ANY kind is provided either by Tim 
  10. Graves or Sun Microsystems
  11.  
  12.  
  13.  
  14. The mail program was written on a Sun SPARCstation running Solaris2 using the SunPRO 
  15. SPARCWorks V2. The suncom program was written on a Sun SPARCstation using SPARC-
  16. works to manage the code with the Psion C Software developer kit running under the SunPC 
  17. PC emulation environment.
  18.  
  19.  
  20.  
  21. Copying: The same basic rules as the GNU license apply. You can copy this program as many 
  22. times as you like and modify it in any way you like as long as you acknowledge my original 
  23. authorship, make it obvious where you have made changes and agree to give anyone who asks 
  24. for it the original code as you received it (or if you prefer with your modifications) for a rea-
  25. sonable copying fee only. If you chose to provide a warrantee that's up to you but I wont pro-
  26. vide any warrantee on these programs or ever will! So there!
  27.  
  28.  
  29.  
  30. Source code: The source code should be available from the same location as you got this docu-
  31. ment. All the code for psion and suncom is held under SCCS but if you have SPARCworks you 
  32. will probably find it easier to use that to work with the code. A SPARCworks source browser 
  33. database may also be in the distribution. For the suncom application you will need the Psion 
  34. Series 3 C software developers kit and some form of PC (yech) or emulation. The sun side 
  35. source is written in K & R C and compiles cleanly (I haven't dared to run it through lint) the 
  36. mail program on the psion should also compile correctly and is written in ANSI C.
  37.  
  38.  
  39.  
  40. This Document: This document was written using FrameMaker V4 It will probably be reada-
  41. ble using subsequent versions of Frame but for use with earlier versions you will need do use 
  42. the MIF (Maker Interchange Format) file enclosed. Changes from the previous version of this 
  43. document are marked with change bars thus.
  44.  
  45. Distribution
  46.  
  47. the psionmail programs are distributed in binary (psionmail.tar.Z or psionmail.tar.Z.uu) format 
  48. compiled for psion 3 and Solaris 2 on SPARC. A small source distribution (pmsmall-
  49. source.tar.Z or pmsmallsource.tar.Z.uu) is available containing the full source but NOT the 
  50. SCCS histories or other SPARCworks files and finally the full source distribution (pmfull-
  51. source.tar.Z or fullsource.tar.Z.uu) which contains the entire source tree including SCCS and 
  52. SPARCworks stuff
  53.  
  54. Psionmail
  55.  
  56. Psionmail is a suite of programs to extract SMTP email, download it to a psion where it can be 
  57. read and new emails written and to upload the new emails. Email extraction is done using the 
  58. POP3 mail system (Of which more later). It is designed to work with my psion/suncom pro-
  59. grams but by editing the shell scripts other programs could be used to transfer the files to / 
  60. from the psion. It is assumed that readers are at least in outline familiar with these programs.
  61.  
  62. If you need to get hold of psion/suncom programs they can be retrieved from the SunSite 
  63. Northern Europe (src.doc.ic.ac.uk) or by contacting me on email. As with the psionmail suite 
  64. of programs they can be obtained in binary (compiled for Solaris 2 on SPARC) or as a small 
  65. and full source distribution.
  66.  
  67. Installation
  68.  
  69. To run any of the incoming mail functions you need to be running a POP3 (Post Office Proto-
  70. col) server on your mail server see the section on POP for details on where to get this. If you 
  71. are only going to be composing email and not reading incoming email the POP server is not 
  72. required.
  73.  
  74. Once the files have been un-tared there will be a psionmail directory. This needs to be installed 
  75. somewhere in your search path. the psion program should also be in your search path The files 
  76. gettxt1.pscmd and puttxt1.pscmd should be places somewhere where the pscmd search path in 
  77. the psion command will find them.
  78.  
  79. You should have a unix2dos and dos2unix program somewhere in your unix search path. The 
  80. commands convert between the differing file formats on dos and unix machines (They are 
  81. standard on Solaris systems). If you do not have these programs you will need to find / build 
  82. something similar and rewrite gettxt1.pscmd and puttxt1.pscmd to use your version
  83.  
  84. From within the psionmail directory you install the applications onto the psion by running the 
  85. command installapp. This will prompt you to start suncom when required. Once the applica-
  86. tions (mail.img and mailrdr.als) have been copied over you will need to install them on the 
  87. psion system screen using the PSION-I key 
  88.  
  89. Once you have installed the applications all other commands can be run from any directory 
  90. that is suitable. Be warned however that these programs create a large amount of temporary 
  91. files. The tidying script tries to be selective but you may find some other files also get removed 
  92. by it. I run these programs from a directory specially created to do these operations in.
  93.  
  94. If you are using my psion / suncom programs please note that you should include the current 
  95. directory e.g. .) in your pscmd search path
  96.  
  97. You should now edit the setupenv script file and as a minimum change the setenv myaddr lint 
  98. to include your email address. If you want to store the mail files on a different SSD or directory 
  99. change the setenv indir and setenv outdir lines as required. 
  100.  
  101. NOTE the SSD and any higher directories must exist whenever you transfer files or read / 
  102. compose email. It is OK to remove an SSD between transfers or when not running the mail 
  103. application on the psion. 
  104.  
  105. DO NOT edit the setenv maildir line as this is hard coded into the mail application. The only 
  106. time this can be changed is if the mail.img and mailrdr.als files are regenerated accordingly
  107.  
  108. To initialise the mta files (See the section on files for a description of the file formats and 
  109. names used) and directories the firsttime script should now be run.
  110.  
  111. NOTE if you want to change the contents of setupenv you MUST run the lasttime script before 
  112. doing so, edit setupenv and then run firsttime
  113.  
  114. If you are going to be downloading incoming email you should now run the talktopopconfig 
  115. program. This will build the config file for pop communications. With the exception of you 
  116. password, pop-3 server name and the name of the machine running the pop server the defaults 
  117. are generally safe to use. These are detailed below
  118.  
  119. talktopopconfig can be rerun whenever you want and will use the last settings as the new 
  120. defaults.
  121.  
  122. NOTE the config file is stored in the current directory so cd to the directory you will be using 
  123. to do transfers before running it. (Naff I know but I couldn't be bothered to work out the home 
  124. directory, this is an RFE)
  125.  
  126. username, the username mail is delivered to on your email server. should be the same as 
  127. your current username
  128.  
  129. password, your current password. for the username given on your email server The pass-
  130. word is not echoed to the screen but be warned. it is saves as clear text in the config file. If 
  131. you do not enter your password you will be prompted for it when downloading incoming 
  132. email.(If you enter it and subsequently change your password on your email server it you 
  133. will need to rerun this talktopopconfig)
  134.  
  135. POP-3 server, this is the name of the machine running the POP-3 server, Inside Sun this is 
  136. called you mailhost
  137.  
  138. Starting point for retrieved filenames, accept the default. This is so when talktopop retrieves 
  139. emails it knows the sequence number to start saving them in
  140.  
  141. delete downloaded emails, if set to true the pop server will delete these emails once they are 
  142. downloaded. Setting to TRUE is more comfortable in that you only have to delete an 
  143. email once but setting to FALSE is probably safer
  144.  
  145. retrieve from the start or end of your email box, if this is TRUE emails will be retrieved 
  146. from the first email in your inbox (i.e. the oldest emails) You will probably want to set this 
  147. to FALSE to retrieve the most recent emails
  148.  
  149. verbose, if you want to know what the pop download is doing set this to TRUE, if you done 
  150. want this (or get tired of seeing it) set it to FALSE
  151.  
  152. maximum email size, to prevent the psion running out of memory you should set this limit 
  153. to the max size of email you want to download, Don't forget that email attachments can 
  154. take up a LOT of space
  155.  
  156. maximum number of emails, again this is to control the amount of memory used on the 
  157. psion. The number here is the maximum number of emails that will be downloaded. (If 
  158. you have not deleted previous downloaded emails they also form part of the count) If you 
  159. are not happy with the default change it but I would use the default initially
  160.  
  161. pop-3 server in the services file, talktopop looks up the name of the POP3 server to deter-
  162. mine which port to use. You should be able to get this from a cat of the services file on the 
  163. server or the NIS/ NIS + master. or take the easy route and ask the system administrator
  164.  
  165. transport mechanism. Unless you have rewritten talktopop you should probably leave this 
  166. as tcp.
  167.  
  168. Running the uploading / downloading applications on the Sun
  169.  
  170. NOTE most of these scripts are VERY verbose.
  171.  
  172. NOTE if you have not entered a password in talktopopconfig any operation involving down-
  173. loading email will require you to enter one (which will not be checked prior to download)
  174.  
  175. NOTE all uploads / downloads will prompt you to start the suncom program on the psion at the 
  176. relevant time. If you are running the mail reader on the psion you MUST exit it before contin-
  177. uing and starting suncom
  178.  
  179. doemail is the command that downloads new email (if there is space), uploads and sends on 
  180. any emails composed on the psion
  181.  
  182. justincomming downloads any new emails (if there is space)
  183.  
  184. justoutgoing just uploads and sends on any emails composed on the psion. This command does 
  185. not require the use of pop
  186.  
  187. Removing / suspending the configuration
  188.  
  189. Sometimes you will not be using the psion mail reader for a while or you will want to change 
  190. the configuration (See below) There are commands provided to do this.
  191.  
  192. lasttime will upload any outgoing email and send it, upload and save any undeleted incoming 
  193. mail (into files names in???.msg) and delete the configuration on the psion. if you subsequently 
  194. want to restart the programs you will need to run the firsttime script which will reset the psion 
  195. configuration.
  196.  
  197. If you want to remove the applications from the psion you should run the removeapp script. 
  198. This will delete the mail.img and mailrdr.als files on the psion. You will need to use the 
  199. PSION-/ sequence to remove these apps from the system screen.
  200.  
  201. Changing the configuration
  202.  
  203. you can run the talktopopconfig script at any time to change the pop configurations. Remember 
  204. to run it from the directory you use for uploading / downloading email
  205.  
  206. If you want to change the settings in setupenv you MUST run the lasttime script. It is then safe 
  207. to edit the setupenv file and the system can be re-initialised with the firsttime script. NOTE if 
  208. you do this any undeleted incoming emails will be saves in files named in???.msg and will be 
  209. removed when you run the firsttime script
  210.  
  211. Running the mail reader on the psion
  212.  
  213. The current implementation of the mail reader is a window based interface using a version of 
  214. the program editor to read / compose emails (called the viewer)
  215.  
  216. If you are in the reader and press one of the system buttons the reader remains active and the 
  217. mail app continues waiting for it to exit. If you have installed the mailrdr.als app it will be 
  218. highlighted in bold on the system screen indicating it is active. Moving the cursor to is and 
  219. pressing return will move you back to the reader. If you have not installed the mailrdr.als app 
  220. you should NEVER leave it except by exiting (PSION-X to see changes or on a 3s PSION-
  221. SHIFT-X to exit and lose changes). The ONLY way to get back to the reader is mailrdr.als is 
  222. not installed if via the spy application provided in the C developers kit. I STRONGLY recom-
  223. mend installing the mailrdr.als app.
  224.  
  225. Once the viewer has been started the mail program will wait untill it completes. To warn you of 
  226. this the status line changes to "Running Mailrdr". it will change back when the viewer is 
  227. exited.
  228.  
  229. NOTE. In the viewer very long lines (approx 500 chars long) seem to cause all sorts of prob-
  230. lems resulting in the viewer locking in a save loop and not writting the file. The indication of 
  231. this is that the viewer will display a flashing "Busy" but will never complete the save. The only 
  232. remedy for this is to kill the viewer process (SHIFT PSION-K over the mailrdr icon on a 3a of 
  233. to use the spy app / killproc command in suncom) By doing this you will lose the edits made in 
  234. the viewer.
  235.  
  236. On starting the mail app it will read in the state of the incoming and outgoing mail queues. All 
  237. the commands listed below will work on either queue with the exception of the header modify 
  238. command(Thus you can change your mind and delete an outgoing email)
  239.  
  240. Once the mta files have been read the incoming queue is selected and the headers are displayed 
  241. in the lower window and status messages displayed in the upper. 
  242.  
  243.  
  244.  
  245. Header window formats
  246.  
  247. When viewing the incomming list the format used is as follows
  248.  
  249. <mail number> <read status> <deleted status> <Sender> : <Subject>
  250.  
  251. When viewing the outgoing list the format is follows>
  252.  
  253. <mail number> <deleted status> <To list> : <Subject>
  254.  
  255. <mail number> is the number of the email in the current list, note there are incomming and 
  256. outgoing lists!
  257.  
  258. <read status> is N if the email has not been read since down loading and R if it has been read. 
  259. Note, if an email has been read but not deleted and further email is subsequently downloaded 
  260. the undeleted email will be marked as New again
  261.  
  262. <deleted status> Will contasin a D if the email is marked for deletion when the program exits, 
  263. otherwise nothing
  264.  
  265. <sender> The email address of the sender (i.e. the return path)
  266.  
  267. <Subject> the subject line>
  268.  
  269. <to list> the names you have selected to send the email to
  270.  
  271.  
  272.  
  273. Upto 5 emails are displayed and the current email will be displayed in bold text. Is the header 
  274. line is to long it will be truncated to fit into the window. If there are emails above the top if the 
  275. current list an up arrow is displayed in the top border and if there are emails below the current 
  276. list a down arrow is displayed in the bottom boarder.
  277.  
  278.  
  279.  
  280. Messages, Sometimes the program needs to present a message to you. It does this by display-
  281. ing s window containing the message text. Press Return or Esc to remove this popup window
  282.  
  283.  
  284.  
  285. Navigating the headers window
  286.  
  287. Navigation of the headers window to select the current email is done using the up and down 
  288. arrow keys (sometimes with modifiers). It is Impossible to fall of the end of the list
  289.  
  290. Use the Up Arrow to move Up the list one email
  291.  
  292. Use the Down arrow to move Down the List one email
  293.  
  294. Use the Up arrow with the CTRL key to move Up 2 emails
  295.  
  296. Use the Down arro with the CTRL key to move Down 2 emails
  297.  
  298. Use the Page Up (PSION key and Up Arrow) to move up one page
  299.  
  300. Use the Page Down (PSION key and Down arrow) to move down one page
  301.  
  302. Use the CTRL Page Up key (CTRL + PSION + Up Arrow) to move to the first email
  303.  
  304. Use the CTRL Page Down key (CTRL + PSION + Down Arrow) to move to the last email
  305.  
  306.  
  307.  
  308. Command keys
  309.  
  310. The commands can either be obtained using the menus (press the menu buttom and navigate 
  311. the menus as usual) or via the PSION-<key> sequence where <key> is the value listed in the 
  312. menu lists
  313.  
  314. Current Email Menu
  315.  
  316.     View Current (PSION-v), Bring up the viewer on the current email
  317.  
  318. Delete Currend (PSION-d), Mark the current emil for deletion
  319.  
  320. Undelete Current (PSION-u), Remove the delete marking on the current email
  321.  
  322. Modify Header (PSION-m), Modify the to, subjct, cc and bcc lines in the header (Outgoing 
  323. emails only)
  324.  
  325. Compose Menu
  326.  
  327. New Email (PSION-n), Ask for the header information and bring up the viewer on the new 
  328. email
  329.  
  330. Reply to sender (PSION-r), Generate a header to reply to the sender of the current email, 
  331. provide an option to midify the header and then bring up the viewer on the current email
  332.  
  333. Reply to all (PSION-a), Generate a header to reply to all recipients (to and cc lists only not 
  334. bcc) of the current email provide an option to modify the current header and then bring up 
  335. a viewer on the new email
  336.  
  337. All of the Compose email functions also ask if the user wished to include the current email 
  338. indented into the new email
  339.  
  340. Special Menu
  341.  
  342. Exit and Save State (PSION-x), Delete and emails in either list marked for deletion, save 
  343. the current state and exit
  344.  
  345. Exit and Lose State (PSION-c), Exit, all deletions are ignored, all new emails written are 
  346. dropped
  347.  
  348. Switch Between Lists (PSION-s), Switch between the incomming and outgoing email lists
  349.  
  350. Files and formats
  351.  
  352. All file formats are native to their current environment and the auto file filtering commands in 
  353. psion comms program will convert from unix (NL terminated) to dos (CRNL terminated)
  354.  
  355. The main file format is called the mta file. there are two of these, one for the incoming list and 
  356. one for the outgoing list. The file format contains a header then repeated entries describing an 
  357. email. The list is terminated with the string END, thus
  358.  
  359. pathname of directory for data files ($indir or $outdir)\
  360.  
  361. your email address ($myaddr)
  362.  
  363. datafile name 1
  364.  
  365. to list 1
  366.  
  367. from list 1
  368.  
  369. subject 1
  370.  
  371. cc list 1
  372.  
  373. bcc list 1
  374.  
  375. read / new status 1
  376.  
  377. datafile name 2
  378.  
  379. to list 2
  380.  
  381. from list 3
  382.  
  383. subject 3
  384.  
  385. cc list 3
  386.  
  387. bcc list 4
  388.  
  389. read / new status 2
  390.  
  391. END
  392.  
  393.  
  394.  
  395. for example an inlist could look like
  396.  
  397. a:\mailin\
  398.  
  399. tim.graves@uk.sun.com
  400.  
  401. in000.msg
  402.  
  403. tom dick harry
  404.  
  405. fred
  406.  
  407. psion to sun communications
  408.  
  409. lindsey
  410.  
  411.  
  412.  
  413. READ
  414.  
  415. END
  416.  
  417. and an outlist for a reply to the email including all recipients but adding george to the bcc list
  418.  
  419. b:\mailout\
  420.  
  421. tim.graves@uk.sun.com
  422.  
  423. out004.msg
  424.  
  425. fred tom disk harry
  426.  
  427. tim.graves@uk.sun.com
  428.  
  429. Re: psion to sun communications
  430.  
  431. lindsey
  432.  
  433. george
  434.  
  435. NEW
  436.  
  437. END
  438.  
  439. Note an empty field must be represented as an empty line. Also that the datafile name does not 
  440. have to be sequential and can have gaps in the sequence. Datafiles for replies do not have ho 
  441. have the same sequence number as the original.
  442.  
  443.  
  444.  
  445. The incoming and outgoing email text is held in files called in???.msg and out???.msg where 
  446. ???
  447.  
  448. is a three digit sequence number allocated by the program. A maximum of 100 outgoing emails 
  449. can be stores and though there is no limit apart from memory on the number of incoming 
  450. emails I use an effective maximum os 10. Note each email required approx. 0.5k to hold its 
  451. data structure
  452.  
  453.  
  454.  
  455. All in.???msg files have their lines wrapped to less than 100 characters (a semi intelligent proc-
  456. ess is used which tries to avoid splitting words so the include function can work. Obviously 
  457. this can be overridden whilst viewing an incoming file but it is really not recommended and 
  458. may cause trouble.
  459.  
  460. There is no line length limit on outgoing email data files
  461.  
  462. The Sun end of things can generate mta files with entries up to 1024 characters. To reduce the 
  463. per email overhead on the psion any mta file entry longer that 100 bytes will be truncated to 
  464. 100 bytes and when the user is composing an outgoing email they should keep their header 
  465. lines to a maximum of 100 characters. (Note this is not enforced and the mail app may crash if 
  466. long header lines are used)
  467.  
  468. The in.mta, out.mta, in???.msg and out???.msg files are also generated on the Sun along with 
  469. in???.msg.hdr and out???.msg.mf files as well. Whenever a transfer to / from the psion is done 
  470. a file called trans.pscmd is generated along with the file /tmp/flist and /tmp/fred (used by the 
  471. filtering stuff. Except in the case of the lasttime command all these files are deleted from the 
  472. Sun when the upload / downloads exit
  473.  
  474. POP3
  475.  
  476. To extract email from the users inbox I use the POP3 protocol and demon. 
  477.  
  478. If you do not have a running pop3 demon it can be found in many locations on the internet (I 
  479. used the WWW archie search engine on Northern Europe SunSite (src.doc.ic.ac.uk) with the 
  480. keyword pop3d).
  481.  
  482. For users who have the Solarnet package from Sun a pop3 demon is included in it. (named 
  483. popper).
  484.  
  485. The Berkley ftp server (ftp.CC.Berkley.EDU, 128.32.136.9 or 128.32.206.12 is reputed to 
  486. have the popper server located there in /pub/popper.tar.Z)
  487.  
  488. You make need to redefine where the pop demon looks for the users inbox. The one I used for 
  489. testing also required a private temporary directory.
  490.  
  491. You will need root privileges to install the demon once it is compiled (The documentation that 
  492. comes with it should indicate if it is for BSD or SVR? based systems). This is one area where 
  493. the documentation seems to be lacking however.
  494.  
  495. The following commands relate to Solaris 2 but should work for any SVR4 system.:
  496.  
  497.  
  498.  
  499. First install the executable in a suitable location
  500.  
  501. edit the /etc/services file on the NIS/NIS+ master to include a line of the form
  502.  
  503. pop-3           2048/tcp                                # Post Office
  504.  
  505. Note pop-3 refers to the service name not the demon executable name, 2048 is the port 
  506. number. you should ensure you chose an unused port. I think that port number 109/tcp may be 
  507. a pop-2 standard
  508.  
  509. edit your /etc/inetd.conf file on the mail server to include a line of the form
  510.  
  511. pop-3   stream  tcp     nowait  root    /usr/local/pop3d      pop3d
  512.  
  513. where pop-3 is the name used in the services file, /usr/local/pop3d is the executable image
  514.  
  515. rebuild the NIS/NIS+ databases to include the new entry
  516.  
  517. do a kill -HUP on the inetd process
  518.  
  519. To test try
  520.  
  521. telnet mailserver 2048 (or the port number)
  522.  
  523. you should get a return something like
  524.  
  525. +OK astir POP3 Server (Version 1.001) ready.
  526.  
  527.  
  528.  
  529. NOTES.
  530.  
  531. The POP3 demon I was using (A freebie version) did not seem to robust. it kept on disconnect-
  532. ing an leaving me with an empty mail box if anything went wrong with the link. My solution to 
  533. this was to edit the pop3 demon so it looked for emails in <myhomedir>/mymailbox. Before I 
  534. ran the incoming email programs I then copied my real mail file (/var/mail/tim) to this holding 
  535. point. The disadvantage of this is that it made deleting downloaded emails pointless as they 
  536. were not deleted from the real inbox and also if I had a mail reader running on my workstation 
  537. with emails deleted since I last saved changes I got the deleted emails included in the down-
  538. load. There was another advantage in that by copying my real inbox I did not have to work 
  539. about any running mail readers getting confused as to the state of the real inbox. Of course I 
  540. could have saved changes to my real inbox and copied the pop munged inbox back to the real 
  541. inbox if it was not zero length but that was to complicated for the testing.
  542.  
  543. One irritating (but not fatal) problem is that the pop demon I used did not seem to be able to 
  544. handle included messages as it looks for lines like 
  545.  
  546. From fred
  547.  
  548. as mail separators. With the sunmail tool that was a problem because many included emails 
  549. include the full header so I received an email in two parts, the header of the email and then the 
  550. included email. This causes some problems. It should however be possible to write a pop3 
  551. demon that understands the Content-Length: xxx header structure.
  552.  
  553. The popper demon in Suns Solarnet product DOES operate using the Content-Length: xxx 
  554. mechanism though it still suffers from the problem of two programs updating the mailbox at 
  555. the same time
  556.  
  557. To do
  558.  
  559. The user interface on the psion needs a lot of work. It should rally be re-written in the style of 
  560. other psion programs with menus etc. This will probably happen in the next release
  561.