BulkMailer can execute VBScript Code within the mail text while the e-mails are being compiled. This means that you can control the contents of each individual email with your own programming.
You access the objects of the e-mail thereby by means of two BulkMailer script objects. As a result of this, you can
- output text
- attach file attachments to the e-mail
- modify the subject line
- load texts/templates from a file
- access the current data record
This means that you will be able to manage the following tasks, for example:
- all recipients of the domain xyz.de receive a different text content
- all of those interested in the product xyz receive product information as an attachment
You will need at least some programming skills of VBScript.
Script Block Masking
A Script Block is masked by the following character string:
An e-mail can contain several Script Blocks. Any VBScript-Code can be specified within this marking.
<% Script-Code %>
- In a PlainText mail, the script block is inserted directly into the email message
- In a HTML mail, the script block must be inserted into the HTML source code
Numbers from 1 to 100
<% For i = 1 To 100 Email.Textout i & vbCrLf Next %>
<% Email.TextOut FormatDateTime(Now, 1) %>
The e-mail object is available to you within the Script Code with the following methods and properties:
Output of the character-string
Email.Subject = "Subject"
read/write the subject
Attach a file
Insert the contents of a text file at this position
Stop generating this e-mail, do not copy it to the outbox
Return value: contents of the current value from this column as a character-string.
Return value: contents of the current value from this column as a variant-type.
(can contain NULL values, numbers, dates, etc.)
The BulkMailer address database internally uses different column names, than shown in the application.
A full listing of the column names can be found here.
Recipients of the domain "xyz" receive an included text from a file
<% If InStr(1, Record("Email"), "@xyz", vbTextCompare) <> 0 Then Email.LoadTextfile "d:\mails\abc.txt" Else %> Standard Mailtext <% End If %>
Those interested in the product "xyz" receive a file attachment
<% If Record("InteresseXYZ") = True Then Email.AttachFile "d:\produktinformation\produktxyz.pdf" End If %>;
*(your database contains a column "InterestXYZ" of the boolean type)
Congratulations to recipients who celebrated their birthday in the last week
<% ' --- calculate birthday If IsDate(Record.Value("Birthday")) Then Const CDays = 7 ' --- can be adjusted Dim dtBirthDay Dim lDiff dtBirthDay = DateSerial(Year(Now), Month(Record.Value("Birthday")), Day(Record.Value("Birthday"))) ' --- handle overflow If 365 - DateDiff("d", Now, dtBirthDay) <= CDays Then dtBirthDay = DateAdd("yyyy", -1, dtBirthDay) End If lDiff = DateDiff("d", Now, dtBirthDay) If lDiff <= 0 And lDiff >= -CDays Then ' had birthday within the past 7 days ' --- add a text block from file Email.LoadTextfile "d:\Birthday.txt" End If End If %>;
VBScript Language Reference Guide
A language reference guide to VBScript can be found in the
Notes concerning protection of registered trademarks
The VBScript technology is the property of the Microsoft Company. Integration into this application has been possible thanks to the outstanding interfaces available with this technology.