This article and example demonstrate how Total Access Emailer can support a table driven system to continuously send emails within your Microsoft Access application.
To do this, we create a simple Access application that regularly checks for new emails to send. We design an email blast with the Total Access Emailer add-in wizard that uses fields from a table that will contain a separate record for each email.
The application then invokes Total Access Emailerís programmatic interface to send new emails when email records appear.
New emails can be added to the table manually or triggered by another action in the application (e.g. a new order, a new customer, an invoice due date). The result is a way for you to send emails from any Access application by simply adding it as a new record in a table.
The Access application requires the following objects:
The Email Shell table contains all of the important parts of the email message:
In our example, this table is named tblEmails with this structure:
Each record in this table is an email. In our example the table is local, but it could just as easily be a linked table shared by everyone in your application. It can also run against a SQL Server table by using an ADP rather than a Jet database.
The interactive Wizard add-in of Total Access Emailer lets you easily create personalized emails. Simply run it with your database, and interactively specify the options for your email blast. The options are presented in separate tabs.
Specify the table name (tblEmails). This populates the dropdown lists for other field references, such as the ToAddress and Subject fields:
Specify the fields for the From, Cc, and Bcc addresses:
For sending plain text messages, use the MessageText field:
For sending HTML messages, use the MessageHTML field:
Specify the AttachmentFiles field to attach any file names in that field:
Make sure auditing is turned on and tied to the SentDate field. This field is automatically updated with the current time when Total Access Emailer sends the message, and prevents this record from getting emailed again.
The Total Access Emailer add-in is also used to configure the email SMTP settings for sending the messages. You can test this email blast interactively to confirm it works the way you expect.
With the Professional Version of Total Access Emailer, you can invoke any of the email blasts programmatically through VBA. It's a simple procedure call:
TotalAccessEmailer(1, True, "", "", False, False)
The important parameters for our example are:
More details about the parameters and programmatic interface are explained in Sending Microsoft Access Email Blasts Programmatically (VBA) and Total Access Emailer's documentation.
You can call the TotalAccessEmailer function from any module in your application. To have it invoked continuously so that it checks for new records in the tblEmails table, use a form with a timer event and open that form when the application starts.
You can set this to run normally or invisibly. On the form's property sheet, set the timer interval to specify how often Emails are sent. In the attached sample database, the form frmEmailer is set to 300,000 milliseconds (5 minutes).
In the formís Timer event, invoke Total Access Emailer's programmatic interface to send the new emails. You can also call it from the form's Open event so that it runs immediately.
When the database opens, you can open the form automatically through an Autoexec macro or naming it as the startup form.
A Microsoft Access database with this example is available for download (31K).
The trial version lets you run the email blast interactively. To use the VBA programmatic interface, you need to have a copy of the Professional Version of Total Access Emailer.
New X.7 Versions for Microsoft Access 2013, 2010, and 2007!
X.6 Versions for Microsoft Access 2003, 2002, and 2000
"I was thrilled with how easy it was to run and I appreciated that I didn't need to build any special tables or queries."
Microsoft Access MVP