<< Click to Display Table of Contents >> Navigation: 3. Script Language > E-Mail Commands > E-Mail Commands |
MiniRobotLanguage (MRL)
SMB. - Send e-Mail Background
Send an e-Mail in the Background
Intention
Send a e-Mail that was previously defined using the SMP.-command.
Sent the E-Mail "Non Blocking", script execution will go on, while the e-mail is been send.
Unlike with SMA., the script execution will not wait until the e-mail is sent.
Instead, the script can go on with execution. The e-mail is sent in the background.
SMB. will leave a "ticket number" that will give you anytime access to the Result of the background operation. Please use DRS. (Drop Result) is you do not want to Get that result of the background operation.
Please see the SMP.-command for further information on how to define and send an e-mail. Example:
' Set E-Mail Configuration
SMP.?path\MailConfig.dat
' Send E-Mail and wait ...
SMB.
' Do anything else you want in this time
' here while the mail is sent
' ...
' Then wait until the background operation has finished.
WRS.
' Get the result of the last background operation on TOS
GRS.
' Always Drop the result, so it won't waste Memory
DRS.
' Return the Answer of the Mail-Server from Stack
DBP.$$000
' End the script
ENR.
How can I get the result of exactly this mail, if its running in the background?
The SMB. - command will drop an "ticket number" on the TOS.
Or, if P2 is given, the ticket-number will be in the given variable.
Now you can get the result any time using the "ticket number" and these commands.
Any result behind an "ticket-number" ist stored as long, until you get it using GRS. or until you Drop it, using DRS. You do not need to wait until the Operation is finished, to drop the result. You can drop the result at any time, even if the Operation is just been started.
Use these commands:
• GRS. - Get Result of Operation
• WRS. - Wait until (one or more) Operation(s) is/are finished
• DRS. - Drop Result of Operation if you do not need it.
to handle the result of the background mail-operation(s).
Example:
' Assume that a file "?path\MailConfig.dat"
' is available
SMP.
' It makes mostly sense with attachements
' SMP.attachment=?path\Send-Mail.zip
' Send the Mail, get the ticket number
SMB.
' If we do not specify a ticket number,
' WRS. will automatically remember the last ticket number
' and use it.
WRS.
' If we do not specify a ticket number,
' GRS. will automatically remember the last ticket number
' and use it.
GRS.
DBP.$$000
' If we do not specify a ticket number,
' DRS. will automatically remember the last ticket number
' and use it.
' DRS. free's the Memory location that was used to hold the
' Result of the background operation.
DRS.
ENR.
In case you need to send multiple Mails with attachments, this can take a while.
To prevent your Script from being blocked, you can use SMB. (Send Mail Background) in that case.
Syntax
SMB.[P1][|P2]
Parameter Explanation
P1 - (optional) If given, this value will overwrite the content of the "Send-To" Field.
P2 - (optional) Variable that will contain the "Ticket-Number" which can be used
to get the answer of the Mail server an any time, using the GRS.-command..
Example
'***********************************
' SMB.-Sample
'***********************************
' Send away 25 Mails
' then wait until they are sent
' and then show the results of all 25 Mails.
'
'#EXE:?pfad\
'#SPI:ForceWrite
'
' Background Mailer-Demo
' Please provide a complete MailConfig.dat
SMP.?path\MailConfig.dat
' Try with attachement also!
' SMP.attachment=?path\Send-Mail.zip
$$HND=
' Be careful or you may end up with in
' an error 421 - too many connections
' from your provider
FOR.$$CNT|1|25
GSB.Lab
NEX.
DBP.$$HND
WRS.$$HND
' Display Results
FEM.Lab_dis|$$TXT|$$HND|,
MBX.!
ENR.
'-----------------------------------------------------------
:Lab_dis
GRS.$$TXT|$$RES
' Always drop Results you do not need anymore
DRS.$$TXT
DBP. Result from $$TXT = $$RES
RET.
'-----------------------------------------------------------
:Lab
SMB.
$$HND=$$HND,$$000
RET.
'-----------------------------------------------------------
Remarks
If you use Background Operations, always drop the result of the operation using DRS..
Otherwise it will be kept in Memory until the Script ends.
Limitations:
When using PRR., the Parallelrobot will not inherit the Mailconfiguration from the Starting Robot. To send Mails in the Background, use SMB.
See also:
• ! Smart Package Robot 's Send-Mail
•