/ Site Map / About Us / General Products / MV Products / Outsourcing / Home page /
PixieRobot: Email Help
Multiple Recipients
Use semicolons to separate multiple recipients and enclose the plain address
only in < ...>
eg
To:
<john@pixieware.com>;<dave@pixieware.com>;<lucy@thetotal.co.nz>
PixieRobot tolerates a range of variations on the above,
eg comma instead of semicolon.
PixieRobot will attempt to put in the
"<" and ">" if you leave them out. Upper/lower case is not significant.
BUT the above example is our strongly recommended ideal.
PixieRobot will send to any address, or semi-colon-delimited addresses,
which you place on the "Bcc:" line.
BUT that line itself is then stripped out
from the message before sending so you can use it for mailing lists which you do
not want viewed or made use of by your recipients.
Multiple Attachments
Use semicolons to separate multiple attachments
eg
X-Attachments:
C:\temp\pixieproxy.exe;C:\temp\preview.zip;C:\temp\scriptlog.txt
X-Attachments: pixieproxy.exe;preview.zip;scriptlog.txt
PixieRobot looks for files without
full path names in the "AttachOut" subfolder.
The semi-colon as separator
is strictly enforced. Unlike multiple recipients, you can not use commas
as an alternative.
Note (this bears repeating): files specified without path
info, ie character "\" does not appear, as per the 2nd
example above, are taken from the defined "attachout" folder and deleted on
send.
Scripting
The challenge that led to this: customers
wanting to carry out custom processing of incoming messages and attachments. eg
distributing attachments to other folders according
to their extensions or who the sender was. It is
also possible to use scripting to reconfigure the
PixieRobot setup in response to command messages you send.
Features and points of our implementation
The PixieRobot methods and
properties are supplied as an implicit object, ie functions such as AttachMove
become part of the VBSCRIPT language for this
environment. If you wish to write in object syntax, that implicit
object is called "IM", so both of the following mean the
same:
Call
IM.AttachMoveAll("\\tserver\xrepos\kt\")
Call
AttachMoveAll("\\tserver\xrepos\kt\")
Some VARs may wish to
script using the System.FileSystemObject. An implicit one of these named FS is
already provided, and you can use all of its methods and properties
directly. eg
Set drv =
GetDrive(GetDriveName(drvPath))
NOTE that you still
need to set and use sub-objects eg drv above
VBSCRIPT - notes
The For ... Next loop requires
that the closing keyword "Next" be on its own with no
variable with it. That can be tricky to get used to,
especially with the less than helpful error message it gives:
"1025, Expected
end of statement" eg:
'
'distribute multiple attachments
For i = 1 To AttachNumber
Call AttachMove(i, sDestination(i))
Next
'note this
must NOT be "Next i"
Method calls eg AttachCopyAll, as in all Visual Basic, have 2
alternative syntaxes: Listing without parentheses, and CALL with
parentheses. eg:
AttachCopyAll
"C:\Program Files\PixiePCL\Brother1\"
or
Call
AttachCopyAll ("C:\Program Files\PixiePCL\Brother1\")
The first
"list" syntax seems to have been the "Microsoft Way" judging by their published
example code, but many of us who work with PICK are more comfortable with the
Call(..) syntax so we
use it in this documentation.
ALSO, fashions are now changing at
Microsoft, eg the new dotNet BASICs will only support use of
parentheses
so that gives a get-used-to-dotNet reason for
using Call(..)
Another syntax:
b = AttachCopyAll("C:\Program
Files\PixiePCL\Brother1\")
What is happening here is that AttachCopyAll
and some other
related methods go further and double as functions
which can return
results "True" or "False" to indicate success of operation.
You use this to script error handling.
eg
b =
AttachMoveAll("C:\Program Files\PixiePCL\Brother1\")
If b = False Then Call
Shutdown
IM
(Internet Mail Object): details of the scripting properties and methods
Grouped by purpose, all
keywords and file/path strings are case-insensitive.
Archive
Boolean property
eg
Archive = True 'files sent are saved
in archive folders
Archive = False '(default) all files sent are
deleted
AttachNumber
How many attached files
there are in the message just arrived.
AttachFile( Index )
String
property to get the name of each attached file by an index from 1 to
AttachNumber
eg
'This script fragment
moves attachments to folders
'according to the file extension
'of the
attachment file name.
'eg "apricot.doc" gets moved to folder
"C:\D3Shared\Transfer\doc"
sFolder = "C:\D3Shared\Transfer\"
For Index = 1 To AttachNumber
Call AttachMove(Index, sFolder
_
& Mid(AttachFile(Index),
Instrrev(AttachFile(Index), ".")) _
&
"\"
Next
Call AttachCopy(
Index, Destination )
Call AttachMove(
Index, Destination )
Copy
or move attachment individually.
These also double as functions
returning True or False eg b =
AttachMove(1, "p:\orders\")
|
Part |
Description |
|
Index |
Number between 1 and AttachNumber |
|
Destination |
String: full path of new file including file name, or, if ending in "\", indicates folder name only and the file name will be automatically added. |
Call AttachCopyAll(
DestinationFolder )
Call
AttachMoveAll( DestinationFolder )
Copy or move all
attachments.
These also double as functions returning True or
False eg b =
AttachMoveAll("p:\orders\")
|
Part |
Description |
|
DestinationFolder |
String: full path of folder to copy or move all attachments into. Should end in "\" but if omitted, a "\" gets automatically added. |
Call AttachMoveAllRename( DestinationFolder
)
Move all attachments with renaming each with a
unique auto-generated name.
Also doubles as a function returning True
or False eg b = AttachMoveAllRename("p:\orders\")
The special purpose
of AttachMoveAllRename is to cope with situations where a
standard name, eg "data.txt", is in common use so a decoded attachment is
at risk of being overwritten by other incoming attachments.
AttachMoveAllRename moves attachments to
DestinationFolder and also generates a timestamp-based
unique name for them.
You can use PathAttach as your
DestinationFolder if all you want is the renaming
without the move elsewhere,
by coding: Call
AttachMoveAllRename(PathAttachIn)
|
Part |
Description |
|
DestinationFolder |
String: full path of folder to copy or move all attachments into. Should end in "\" but if omitted, a "\" gets automatically added. |
MsgFile
Name of the base message file
Msg
Complete text of the base
message
Header
Full Header text of
the base message,
Also has optional argument (case insensitive) with which it can extract
header values:
Header("Date"), Header("To"),
Header("From"), Header("Subject"),
Header("CC"), Header("BCC"),
Header("X-Attachments")
Body
Body text of the base message
Call MsgCopy(
Destination )
Call MsgMove(
Destination )
Copy
or move the base message.
These also double as functions returning
True or False eg b = MsgMove("p:\orders\")
|
Part |
Description |
|
Destination |
String: full path of new file including file name, or, if ending in "\", indicates folder name only and the file name will be automatically appended. |
PathHome
PathMsgIn
PathMsgOut
PathAttachIn
PathAttachOut
PathExtMap
PathExtMapArchive
PathExtMapReject
String properties getting or setting full
folder paths ending with "\".
We anticipate that you would usually only want
to read these to find
your files, but you could also use this scripting
to re-define them by
remote control when you
send command emails to PixieRobot.
eg:
PathExtMap
= PathHome & "extmap\" 'define an extmap folder
PathAttachOut =
"C:\D3Shared\Transfer\AttachOut\"
RawLinesNumber
Number of lines in the
original raw message including coded
attachments.
RawLine(Index)
String value of raw message line, Index between 1
and RawLineNumber
eg to reconstruct the raw message as a
file
For i = 1 to
RawLineNumber
sRaw = sRaw & RawLine(i) & vbcrlf
Next
i
Call
OutputToFile(sRaw, "\\tserver\test\imdiagnose\"
& CStr(Timer) & ".txt")
Call OutputToFile( Data, Destination
)
Write string data as a disk file. See RawLine
immediately above for example.
Very useful for logging
results of scripting when developing scripts.
|
Part |
Description |
| Data | String to write to disk as data |
|
Destination |
String: full path of new file including file name |
stringData =
FileGetText(File_with_full_path_name)
Read contents
of a file into stringData. Useful for reading the contents of an
attachment to feed into other systems like databases. eg
stringData = FileGetText(PathAttachIn &
AttachFile(Index))
Call Restart
Restart the PixieRobot server. Useful for remote
control, eg you could email in a new .ini file
as the body of a message,
use
Call OutputToFile(Body, PathHome
& "PixieRobot.ini")
.. to put that into
place..then
Call
Restart
.. to get it to take effect.
eg
If Header("subject") = "ReConfigureINI_pwd_gladiator"
Then
Call OutputToFile(Body, PathHome &
"PixieRobot.ini")
Call Restart
End If
Call Shutdown
Emergency Stop for
the PixieRobot server. Useful as a response to severe error
situations.
eg: you want to use AttachMoveAll to copy incoming attachment
files to a networked drive
but the FileServer is not working. A simple
approach is to stop, and let the email queue up
on the Email
Server.
eg
b = True
If Instr(1, Header("To"), "orders@", 1) Then
b = AttachMoveAll("g:\d3Shared\orders\")
End If
If b = False Then
'-- do EMERGENCY STOP
Call LogMessage("ERROR SEVERE SHUTDOWN. Failure to do AttachMoveAll " _
& "so PixieRobot EMERGENCY STOP.")
Call Shutdown
End If
Call
LogMessage( MessageString )
Displays your
Message in the monitor window listbox, and also writes it to the log file,
adding a date/time stamp.
| Part | Description |
| MessageString | Message to log |
| Destination | String: full path of new file including file name |
LoggedMessage
String Property, returns the
previous logmessage sent to the logfile and monitor.
A general-workout and demonstration script, "onReceiveTest.txt" is installed with the package. To activate it, change its name to "onReceive.txt". It is repeated below:
Sub Main
'General test and demo program of a range of scripting
'Note that this script will re-run with every message, so
'IF there are several messages in a batch delivery
' THEN you will only get a report file written for the last one.
'
'A) Checking PixieRobot properties as setup from PixieRobot.ini
'
s = "onReceive.txt Scripting Test, " & Now & vbcrlf & vbcrlf
s = s & "Check settings:" & vbcrlf
s = s & "ReturnAddress = " & ReturnAddress & vbcrlf
s = s & "PathHome = " & PathHome & vbcrlf
s = s & "PathAttachIn = " & PathAttachIn & vbcrlf
s = s & "PathAttachOut = " & PathAttachOut & vbcrlf
s = s & "PathMsgIn = " & PathMsgIn & vbcrlf
s = s & "PathMsgOut = " & PathMsgOut & vbcrlf & vbcrlf
'
'B) List attachments with this message
'
s = s & "Attachments:" & vbcrlf
s = s & "AttachNumber = " & AttachNumber & vbCrLf
For Index = 1 to AttachNumber
s = s & "AttachFile(" & Index & ") = " _
& AttachFile(Index) & vbCrLf
Next
'
'
'C) Copy all attachments to another folder. Change "C:\TEMP"
'to something more appropriate for you if need be
'
Call AttachCopyAll("C:\Temp")
'
'D) Retrieve parent message header (1) as 1 text, (2) by individual line
'
s = s & vbcrlf & vbcrlf
s = s & "Header function test" & vbcrlf
s = s & "1) total header:" & vbcrlf
s = s & Header & vbcrlf & vbcrlf
s = s & "2) by lookup:" & vbcrlf
s = s & "Header(""Date"") = " & Header("Date") & vbcrlf
s = s & "Header(""To"") = " & Header("To") & vbcrlf
s = s & "Header(""From"") = " & Header("From") & vbcrlf
s = s & "Header(""Subject"") = " & Header("Subject") & vbcrlf
s = s & "Header(""CC"") = " & Header("CC") & vbcrlf
s = s & "Header(""BCC"") = " & Header("BCC") & vbcrlf
s = s & "Header(""X-Attachments"") = " & Header("X-Attachments") & vbcrlf
'
'E) Write to file this report string s we have built
'
Call OutputToFile( s, "testScriptFns.txt")
'
End Sub
/ Site Map / About Us / General Products / MV Products / Outsourcing / Home page /