<< Click to Display Table of Contents >> Navigation: 3. Script Language > E-Mail Commands > E-Mail Commands |
MiniRobotLanguage (MRL)
SMP. Command
Set e-Mail Parameter
Intention
The SMP. command will define all parameters, that are needed to send an e-mail, using the SMA. - command.
You have two ways to use the SMP. - command:
1. Use it to load an "MailConfig.dat" file with an previously saved, encrypted Mail-Configuration.
2. Use it to define some or all parameters directly. In this mode, parameters that have already been defined using a "MailConfig.dat" can be overwritten with other values.
Let's start using Mode 1 and the "MailConfig.dat". How do you generate this file?
There is GUI-Utility that helps you to generate it. You can read all this here:
! Smart Package Robot 's Send-Mail
Be sure to read that before going on.
whether you use a "MailConfig.dat" as Base-Configuration, or not, in any way you can set or change Mail-Parameters using SMP.
Actually you can not retrieve Mail-Parameters that have been set. If you are not sure about these values, just set them again with the proper values. This way, any parameters that have been set using the "MailConfig.dat" are kept secret.
Let us now take a look on how you are really sing to sent an e-mail, in both modes of operation.
If you have already defined an "MailConfig.dat" file, and placed it in ?path\, then there is not much to do. Your script could look as simple as:
' SMP without any parameter will load a file called
' "MailConfig.dat" from ?path\
SMP.
' SMA. will just send away the previously defined e-mail.
SMA.
' Thats just the END of the Script
END.
Now in most cases, you may have defined a base-Configuration containing your provider-Settings etc. in a "MailConfig.dat" file. And you add all variable settings later using SMP. Like in this example:
' First we load our predefined Mailconfiguration
SMP.
' Now we add two file-attachments
SMP.addfile=?path\Text.txt;?desktop\File.zip
' This is the new text for our mail
SMP.text=Hallo Peter$crlf$Do you have time this weekend for a football match?
' We make sure that the mail is sent as an plain-text-mail
SMP.style=plain
' We set the receivers e-mailaddress
SMP.to=Peter@c10.de
' Now we let our bird fly.
SMA.
' and end the script
ENR.
But there is no need to use the "Mailconfig.dat" file. You can do the whole Mail-configuration solely using the SMP.command. You will however need to write a bit more, like in the following example:
SMP.smtp-server=smtp.1und1.de
SMP.port=25
SMP.sender=you@yourdomain.com
SMP.receiver=yourfriend@hisdomain.com
SMP.subject=Invitation
SMP.text=Hallo friends,$crlf$this is going to be interesting!
SMP.auth=1
SMP.password=dsa8sdkj-*
' And let it go ...
SMA.
' Print if it was OK
DBP.$$000
ENR.
As you can see, we did not specify the fields:
• reply-to
• login
because these two are set automatically to the same value as "send from", in case you leave them "empty".
The field "Localhost" is been set to the name of the actual computer, once when the robot starts up. If you clear the field, it will be automatically set to the term "localhost".
The following fields are set up with default values, once the robot starts up:
Timeout = 60 seconds
CharSet = "iso-8859-1"
Style = "plain text"
SMTPPort = 25
EnableAuth = %FALSE
AuthType = "AUTH LOGIN"
LocalHost = actual Computer's name
Syntax
SMP.[P1]
Parameter Explanation
P1 - (optional) can be one of two formats:
1. empty, in this case a file "MailConfig.dat" is searched for
in "?path\". If the file is found, it is loaded and all values
are set according to the content of the file.
2. A value-equation, like: smtpport=25
in this case, the equation is been evaluated and the value
is set. You can not make multiple equations in a single line.
Use a new line with a new SMP.-command for each necessary
equation. This was necessary, to have all sorts of characters
available for the "text" and the "password" fields.
Also you will find it very readable.
You can specify the following equations. Note that for all equations, the term on the left side is not case sensitive.
"SMTP-Server","smtp"
Will choose the desired SMTP-Server.
Examples:
SMP.smtp=pop.gmail.com
SMP.smtp=pop3.live.com
SMP.mail.comcast.net
SMP.popmail.t-online.de
"SMTP-Port","SmtpPort","port"
Will choose the desired SMTP-Server Port.
Often used values are 25 or 587. As the value of 25 is pre-set, in many cases you do not need to touch this setting.
Example:
SMP.port=25
SMP.port=587
"SendFrom","send from","send-from","from","Sender"
Will set the e-mails "sender" address. This is the mailaddress that is shown to receiver of the mail, when he finds the mail in his Inbox. You have to specify something that looks like a e-mail address in this field, to have the mail sent.
Note that this is not necessarily the mail addresss, a "reply" will be sent to. Use the "Reply-to" field for this.
Example:
' All three lines below do the same.
SMP.Sender=info@it-berater.org
SMP.from=info@it-berater.org
SMP.sendfrom=info@it-berater.org
"receiver","sendto","send-to","to"
You need to specify this field. It must contain a valid e-mail address.
This field contains the e-mail address of the primary receiver(s) of the e-mail.
You can specify multiple receivers, if you separate them using a semicolon ";".
There is no limitation on number of receivers from the SMP.-command.
Note that any receiver can see all other receivers that are in the receiver field.
Example:
SMP.receiver=mailbox1@fa2.de;yourmail@c10.de
SMP.to=mailbox1@fa2.de;yourmail@c10.de
SMP.send-to=mailbox1@fa2.de;yourmail@c10.de
"CC","Carbon Copy","carbon-copy"
You do not need to specify this field. If you do so, it must contain a valid e-mail address.
This field contains the e-mail address of secondary receiver(s) of the e-mail.
You can specify multiple secondary receivers, if you separate them using a semicolon ";".
There is no limitation on number of CC-receivers from the SMP.-command.
Note that any receiver can see all other receivers that are in the CC-receiver field.
Example:
SMP.CC=mailbox1@fa2.de;yourmail@c10.de
SMP.carbon copy=mailbox1@fa2.de;yourmail@c10.de
SMP.carbon-copy=mailbox1@fa2.de;yourmail@c10.de
"bcc","blind copy","blind-copy"
You do not need to specify this field. If you do so, it must contain a valid e-mail address.
This field contains the e-mail address of secondary receiver(s) of the e-mail.
You can specify multiple secondary receivers, if you separate them using a semicolon ";".
There is no limitation on number of CC-receivers from the SMP.-command.
Note that any receiver that was specified in the BCC-field is hidden and can not be seen by all other mail-recipients Example:
SMP.BCC=mailbox1@fa2.de;yourmail@c10.de
SMP.blind copy=mailbox1@fa2.de;yourmail@c10.de
SMP.blind-copy=mailbox1@fa2.de;yourmail@c10.de
"Reply","reply to","reply-to","ReplyTo"
You do not need to specify this field. If you do so, it must contain a valid e-mail address.
This field contains the e-mail address that a mail will be sent to, if the recipient of the mail click on the "Reply" button.
Example:
SMP.reply=mailbox1@fa2.de
SMP.reply to=mailbox1@fa2.de;yourmail@c10.de
SMP.replyto=mailbox1@fa2.de;yourmail@c10.de
"subject","titel"
This is the Subject of your e-mail. You do not need to specify a subject.
SMP.Titel=Birthday Invitation
SMP.Subject=Testing Result from X5/8452
"plain-msg","plain-message","text","text-msg"
This field contains a plain-text message, if you send one. There is no limit in text-size from the SMP.-commands. There may however very likely be a limit from your SMTP-Server for the total size of your mail.
You would do something like this:
' Read Textmessage from a file
CFF.$$FIL|$$TXT
' You can do Text-Replace here to customize Mails.
' using the String-Commands.
' This Line will set the text for the Mail
SMP.Text=$$TXT
"html","html-text","html-msg","Html-Message"
This field contains a html-text message, if you send one. There is no limit in html-text-size from the SMP.-commands. There may however very likely be a limit from your SMTP-Server for the total size of your mail. You can do something like this:
' Read Textmessage from a file
CFF.$$FIL|$$TXT
' You can do Text-Replace here to customize Mails.
' using the String-Commands.
' This Line will set the text for the Mail
SMP.HTML=$$TXT
"auth","anmeldung","authentication"
This field contains a "1" if the SMTP-Server needs a User-Authentication and a "0" if not.
You can also use the terms "On" and "Off" to make it more readable.
Examples:
SMP.Auth=On
SMP.Authentication=Off
"Auth-type"
This field contains the only currently supported Authentication type. You can change it, however that may lead to unforeseeable results. Most likely things will not work anymore.
If you set this field to empty, it will automatically be reset to its default value, that is "AUTH LOGIN".
"Login","user","Username","Auth-Username"
If User-Authentication is set to "On", then this field contains the Login-credential.
This is most often the users e-mail-address.
If you leave this field empty, then it is automatically filled with the content of the "sender" field. Example:
SMP.Login=info@it-berater.org
"pwd","Password","pass","AuthPassword"
If User-Authentication is set to "On", then this field contains the needed Password.
The password can contain any character, especially if you deliver it inside a variable.
Variables behind the password-field are only resolved once (binary compatible).
Therefore your password could contain a sequence like "$$TXT" without having it resolved as a variable, if the password itself is fully inside a variable. You can use the VAB.-command to specify a password safely. If you do not want to specify the password openly visible, use the "MailConfig.exe" and encrypt it inside the "Mailconfig.dat" file.
Example:
' This will really work.
VAB.$$PWD=a3D$$TXA34?pa
SMP.pwd=$$PWD
' This is the normal case
SMP.pwd=das8!%sasad34_2
"pc","localhost","host","SenderHost"
The localhost field specifies the name of the sending computer.
If you set the field to empty, because you do not want your computers name to show up,
it will internally be set to "localhost"-
"style","msg-style","MessageStyle","message-style"
Using this field, you can specify the e-mail format.
That is, if you want to send the e-mail as "Plain Text" or as "HTML-Text" or as both.
The default format is "Plain" and therefore you may not need to change that in most cases. You can choose between:
• "1","Plain"
• "2","html"
• "3","Both"
Example:
' Send message as Text-Message
SMP.style=plain
' Send Message as HTML Message
SMP.style=2
' Send Message as combined Text/HTML Message
SMP.style=Both
"attachment","addfile","sendfile"
You can add attachments to your e-mail. Unlike all other properties, attachments can only be added using the SMP.-command. They can not be predefined in the "Mailconfig.dat" file. There is no technical limit on the number of attachments until your Mail-Server will not accept any more.
To add one or more attachments, just add their filenames (including pathes) separated by semicolons behind the SMP. command. Like this:
SMP.addfile=?desktop\myfile.zip;?path\mytext.txt
' You can also specify a variable, if the line
' would be getting too long otherwise.
SMP.sendfile=$$FIL
SMP.attachment=$$FIL;$$FIA;$$FIB
"char","Char-Set","chars","charset"
You can specify the used char-set to have the receiver see the mail in the proper way.
Most often, you will use just:
' Use "us-ascii" charset
SMP.char=us
or
' Use "iso-8859-1" charset
SMP.char=iso
You can specify any other char-set you want:
' PL, CZ etc. may use this charset
SMP.char=iso-8859-2
"TimeOut","Server-TimeOut","ServerTimeout"
This field contains the Server-Timeout in seconds.
If the server does not respond within this time, an error is been internally generated.
More Hints:
The fields:
• reply-to
• login
are set automatically to the same value as ifrom "send from", in case you leave them "empty".
The field "Localhost" is been set to the name of the actual computer, once when the robot starts up. If you clear the field, it will be automatically set to the term "localhost".
Because it can't be empty.
The following fields are set up with default values, once the robot starts up:
Timeout = 60 seconds
CharSet = "iso-8859-1"
Style = "plain text"
SMTPPort = 25
EnableAuth = %FALSE
AuthType = "AUTH LOGIN"
LocalHost = actual Computer's name
Example
'***********************************
' SMP./SMA.-Sample
'***********************************
' First we load our predefined Mailconfiguration
SMP.
' Now we add two file-attachments
SMP.addfile=?path\Text.txt;?desktop\File.zip
' This is the new text for our mail
SMP.text=Hallo Peter$crlfDo you have time this weekend for a football match?
' We make sure that the mail is sent as an plain-text-mail
SMP.style=plain
' We set the receivers e-mail-address
' please put your own mail-address here
' so you can receive your own Test-mail.
SMP.to=Peter@c10.de
' Now we let our bird (with the message) fly.
SMA.
' and end the script
ENR.
Remarks
-
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