|
BulkMailer 2008 Help
Help Start Page Advanced Techniques:
Importing Addresses
Problems: |
|
ScriptingBulkMailer 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
This means that you will be able to manage the following tasks, for example:
PrerequisitesYou will need at least some programming skills of VBScript.Kroll-Software cannot offer any support for VBScript programming. We would however be happy to advise you of the available possibilities and to give you brief indications as to whether or not you can implement a particular requirement and how to go about doing so.
Script Block MaskingA Script Block is masked by the following character string:
<% Script-Code %> An e-mail can contain several Script Blocks. Any VBScript-Code can be specified within this marking.
Examples:
Numbers from 1 to 100: <% For i = 1 To 100 Email.Textout i & vbCrLf Next %>
Current Date: <%Email.TextOut FormatDateTime(Now, 1) %>
The Email-ObjectThe e-mail object is available to you within the Script Code with the following methods and properties:
Email.Textout "String"Output of the character-stringEmail.Subject = "Subject"read/write the subjectEmail.AttachFile "FielPath"Attach a fileEmail.LoadTextfile "FilePath"Insert the contents of a text file at this positionEmail.CancelStop generating this e-mail, do not copy it to the outboxThe Record-ObjectRecord("Column Name")Return value: contents of the current value from this column as a character-string.Record.Value("Column Name")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. ExamplesRecipients 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 Text <%End If%>
Those interested in the product "xyz" receive a file attachment
<% If Record("InterestXYZ") = True Then Email.AttachFile "d:\productinformation\productxyz.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 changed Dim dtBirthDay Dim lDiff dtBirthDay = DateSerial(Year(Now), Month(Record.Value("Birthday")), Day(Record.Value("Birthday"))) ' --- Overflow at end of year ? 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 ' birthday was in the last 7 days ' --- Insert textfile with congratulation Email.LoadTextfile "d:\birthday.txt" ' --- must be changed End If End If %>
VBScript Language Reference GuideA language reference guide to VBScript can be found in theMSDN Library
Notes concerning protection of registered trademarksThe 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.
Copyright (c) by Kroll-Software, Zug/CH 1999-2010
|
|