Campaigns Sent On A Trigger
By: Chris Lewis
One of the uses of Campaign Enterprise is to send out triggered emails like for birthdays, anniversaries, or other info that has to be sent on X-amount of days after a date. The following example sends out an email 3 days after someone signs up for information:
First, we have a table where information about your signups are stored. For this example we will call this tblSignups. In this table, we need a date column in this table to trigger on in your email. For this example, we will have the column called "SignupDate" and this should be set at the date that the person signs up on your website.
Next, we create a campaign that we want to use to send the email and on the Datasource tab we use this following SQL statement (assuming MS SQL Server):
SELECT * FROM tblSignUps WHERE DateDiff(dd,SignupDate,GetDate())=3
Now for this Campaign to work, the campaign will need to be scheduled to run each day at the same time. If a day is missed, then that day's emails will not go out. The only way to make sure all emails go out is having another column in the database that is marked when the email is sent, and then you can check that in the SQL statement used for sending. For example, if you had another column called EmailSent (a BIT type) that was set when the email was sent, you would use an SQL statement like this:
SELECT * FROM tblSignUps WHERE DateDiff(dd,SignupDate,GetDate())=>3 and EmailSent=0
You can add more sophistication to these statements but this is a good start.
Leave a Reply.