AY Mail Script API
[Professional and Corporate Editions Only]
You can use script macros to let your own scripts generate the text of the messages. AY Mail supports scripting engines installed on your computer. Click here for the list of available scripting languages.
This text requires programming skills and is not suitable for a regular user.
When AY Mail encounters the Script macro, it loads the specified script from the file into the scripting engine. The script gets executed for every recipient, so you can use it to generate a highly personalized text.
Script has access to two objects:
document object represents a message being generated and has the following members:
seqn lets you access the sequence number of the document in the session. You can use it to find out if this is a first execution of the script. If it is equal to 1, this is a first execution and you can initialize your variables.
write(text) puts the text into the message. May be called multiple times.
abort(text) aborts the sending and display the text. Aborts occurs when the script has finished the execution.
skip instructs AY Mail to skip the recipient.
recipient object gives the access to the recipient data and has the following members:
email returns a string representing recipient email address
item(name) retrieves the object representing the field specified by the name. You can also access the fields directly. For example, if you have a data field called "Name", you can access it as recipient.item("Name") or as recipient.Name
value(name) retrieves the value of the data field specified by the name.
text(name) retrieves a string representation of the data field specified by the name.
unknown(name) lets you find out if the value of the data field specified by the name is known.
exists(name) lets you find out if a data field with the specified name exists in the recipient list.
date retrieves the object representing the date when the recipient was first created.
The objects returned by item or date have the following properites:
value retrieves the value of the corresponding type or undefined value if the field is unknown.
text retrieves a string presentation of the object.
unknown lets you find out if the value of the object is known.
Access to the objects and properties is case-sensitive even though the scripting language may not be case-sentive (such as VB Script).
Click here for language scpecific information.