[pmmail-list] how to BCC without To: SOLVED! and a Visual Basic Script

L.Willms pmmail-list@blueprintsoftwareworks.com
Thu, 17 Feb 2005 21:31:21 +0100 (MEZ)


On Wed, 16 Feb 2005 17:06:55 +0100, rooster wrote:

> Now, I created a gmx mail-account.
> This account has one filter -> all incoming - delete immedialty.
> So the server will never bounce a mail, cause the usable space is 
always full available.


   That is certainly a good solution, but instead of a TO: you could 
also insert a special header, as several mailing list handler do, e.g.: 

   
> Mailing-List: list rooster-distribution-list@onemail.at; contact 
rooster-distribution-list@onemail.at

   Or a TO: in the form as described in RFC-2822: 

----schnipp-----------------------
   When it is desirable to treat several mailboxes as a single unit
   (i.e., in a distribution list), the group construct can be used.  The
   group construct allows the sender to indicate a named group of
   recipients. This is done by giving a display name for the group,
   followed by a colon, followed by a comma separated list of any number
   of mailboxes (including zero and one), and ending with a semicolon.
   Because the list of mailboxes can be empty, using the group construct
   is also a simple way to communicate to recipients that the message
   was sent to one or more named sets of recipients, without actually
   providing the individual mailbox address for each of those
   recipients.
-----------schnapp----------------

   Anyway, since I mentioned the possibility to write a Visual Basic 
script for filtering, I have written one which deletes the TO: header 
line, and which can serve as a model for other scripts. 

   This is the first VBS which I have written using the "File System 
Object" (fso) of Windows Scripting. 

   This applies only to Windows. REXX is also available on Windows and 
OS/2, Perl is available for both. So my use of VBS is not meant to keep 
others from using other languages (on OS/2 I do use REXX). 

   Ah, one important note: for using VBS in a PMMail filter, one has to 
enter "wscript the-script-name.vbs" in the User Hook field, or "cscript" 
instead of wscript. Otherwise it will not execute. 

   So here is my PMMfilter_del-TO.vbs 
   It is included quoted so that PMMail does not fold the lines. 
    
----schnipp-----------------------
> ' VB Script  Filter für PMMail: 
> ' Löscht die TO: Adresse aus dem Header 
> ' Copyright Lüko Willms, http://www.willms-edv.de 
> ' PMMail übergibt als ersten und einzigen Parameter den vollständigen 
Dateinamen
> '     der MSG-Datei, die zu bearbeiten ist, d.h. als Pfad inclusive 
verzeichnisnamen
> '   Es funktioniert aber auch mit lokalen Namen 
> ' 
........................................................................
.......
> Option Explicit
> 
> Dim objArgs        ' Argumente auf der Kommandozeile
> Dim fso            ' File System Object 
> Dim workFolder     
> Dim mailFile, mailName               ' Objekt und Strings für die 
Maildatei von PMMail
> Dim tempFile, tempName, tempPfad     ' Objekt und Strings für 
temporäre Datei 
> Dim eingabe, ausgabe   ' die beiden Dateien als TextStream-Objekte 
> Dim textZeile 
> Const ForReading = 1
> Const ForWriting = 2
> 
> Set objArgs = WScript.Arguments
> Set fso = CreateObject("Scripting.FileSystemObject")
> 
> mailName = objArgs(0)
> Set mailFile = fso.GetFile(mailName)
> workFolder = fso.GetParentFolderName(mailFile.Path)
> mailName = fso.GetFileName(mailFile.Path)
> 
> tempName = fso.GetTempName
> tempPfad = fso.BuildPath(workFolder, tempName)
> Set tempFile = fso.CreateTextFile(tempPfad, false, false)   ' nicht 
überschreiben, ASCII statt Unicode
> Set tempFile = fso.GetFile(tempPfad)  ' tempName)
> 
> Set eingabe = mailFile.OpenAsTextStream(ForReading) '  zum Lesen als 
ASCII-Datei
> Set ausgabe = tempFile.OpenAsTextSTream(ForWriting) '  tempräre Datei 
zum Schreiben
> 
> textZeile = eingabe.ReadLine
> Do While Not(eingabe.AtEndOfStream OR Len(textZeile) = 0 OR 
UCase(Left(textZeile, 3)) = "TO:")
>   ausgabe.WriteLine(textZeile)
>   textZeile = eingabe.ReadLine
> Loop 
> If UCase(Left(textZeile, 3)) = "TO:" Then
>   Do 
>     textZeile = eingabe.ReadLine
>   Loop Until Not Left(textZeile, 1) = " "
> End If
> Do While Not eingabe.AtEndOfStream 
>   ausgabe.WriteLine(textZeile)
>   textZeile = eingabe.ReadLine
> Loop
> ausgabe.Close
> eingabe.Close
> 
> mailFile.Delete
> tempFile.Name = mailName          ' rename the temp file to the file 
used by PMMail   

-----------schnapp----------------


Yours, 
Lüko Willms
-----------------------------------------------
Frankfurt/Main