Chapter 11. Using the Send Mail Task
The Send Mail Task sends email via Simple Mail Transfer Protocol (SMTP) from a SQL Server Integration Services (SSIS) package. This task allows you to receive information about the package that can be passed into the mail task through variables — system variables or user-defined variables. The Send Mail Task is most commonly used as a notification tool. The system variables in an SSIS package hold information such as package start time, errors, and warnings.
The Send Mail Task can be placed at the end of a Control Flow to send email on the successful completion of a package. The Event Handler of a package can also be a great place to place the Send Mail Task (event handlers are covered in Lesson 38). The task can be placed in the OnPreExecute Event Handler to notify you via email that a package has begun. The OnPostExecute Event Handler can send mail at the end of a package showing the start and end for a package, therefore allowing you to track the runtime of a package. When a Send Mail Task is placed in the OnError or the OnWarning Event you can be notified when an error or warning occurs anytime during the running of a package.
The Send Mail Task can also be used to send files, because it has the ability to send attachments. A Data Flow can exist in a package that creates a file, and a Send Mail Task can then send that file via email. The file can be created in a Data Flow or by a File System Task. It can also be any file not created or altered ...
Get Knight's 24-Hour Trainer: Microsoft® SQL Server® 2008 Integration Services now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.