With Office 365 as your mail server a cap of 30 emails per minute is introduced. If a task is producing a high volume of emails that exceeds this limitation then the following error will occur:
4.4.2 Message submission rate for this client has exceeded the configured limit
Slow down the rate at which the emails send to prevent the limit from being reached.
This is achieved by running the task on a loop and creating a waiting period after every email is sent. The task is setup so that it only processes one row per each task run, therefore sending one email before waiting and then starting again.
Two additional tool steps will be required; Run VBScript and Decision. A flag in the database table will also be created at runtime to indicate that a row has been processed.
The Run VBScript step is used to cause a delay before the task is run again. A Decision step is used to ensure that the task will complete and stop looping once all rows have been processed. The flag is used by the Database Query step to determine which rows have not been processed.
Figure 1. Example task set upon a loop using a Run VBScript and Decision step
For detailed instructions continue as follows:
Implementing the Procedure
- The database table being queried will require a new column which will be used to flag when a row has been processed; for this example the column can be called Processed. The column will require a value of 0 (zero) for every row. The output email step will use External Memory to write to the table a value of 1 to flag when a row has been processed.
- Within the database query create a criteria which will only return rows where the Processed column is equal to 0 (zero). Use the Predicates icon in the toolbar to allow the query to only return the top row. This is a requirement which enables the task to only process one row per task run.
Figure 2. Predicates dialog box configured to only return the top row of the database query.
- Within the task place a Run VBScript step after the email step, a recordset or document source is not required. Within the Main tab of the tool enter the following script: WAIT 2000
Note: The time delay is measured in milliseconds, this example shows a delay of 2 seconds.
Figure 3. Main tab of VBScript tool
- Link the VB Script step to the beginning task step to create a loop.
- Create a Decision step and place it after the Database Query step. A decision branch with an expression is required to prevent the task from looping when the database query returns 0 (zero) rows.This is achieved by using the property RowCount from the task browser. With the Scope set to Task, expand the Database Query node to locate the property and drag it into the Script tab of the Branch Editor.The script is as follows: Steps(“[DATABASE QUERY]”).RowCount < > 0
Figure 4. Decision tool Branch Editor. Script required to prevent the task from continuously looping.
- Within the Send Email (SMTP) step use the Memory button to create an ODBC or OLEDB memory definition. This will need to write a value of 1 to the Processed column of the database table at task runtime indicating that the row has been processed.Each time the database query executes it will know to move on to the next row based on the criteria specified and this flag.
Figure 5. Example showing the use of memory to write to a database table at task runtime.
This completes configuring the task environment. When the task now runs it will send one email at a time using the time delay specified until all rows have been completed.