SSIS Send HTML Email Task
PreviousNext

SSIS Send HTML Email Task can be used to send any news letters or great looking HTML emails from SSIS. It support SMTP connection with UserID/Password so you are not stuck with your company email server. Auto expanding placeholders can make it super easy to create flexible email templates in few minutes without messing up with SSIS expressions.

Download SSIS PowerPack

Content

Video Tutorial

Coming soon...

Step-By-Step

In this tutorial we will learn how to send email from Internet using SSIS HTML Email Task with just few clicks (In this case using SQL Server Table).
  1. Firstly, You need to Download and Install SSIS ZappySys PowerPack.
  2. Once you finished first step, Open Visual Studio and Create New SSIS Package Project.
  3. Let's, Drag and Drop Execute SQL Task and ZS HTML Email Task from SSIS Toolbox.
    SSIS Send HTML Email Task - Drag and Drop
  4. We need SMTP Connection, OLE DB Connection and Variables for this task.

How to create SMTP Connection.

  1. Right click on Connection Managers Panel and Context Menu will appear, Select New Connection from the Context Menu.
    SSIS Create New Connection
  2. Select ZS-SMTP Connection Manager from the Connection Managers list and Click on Add Button.
    SMTP Connection Manager
  3. In the connection manager UI, enter smtp server and uncheck on Anonymous Authentication. Enter your correct User Name and Password and enter Test Email.
    SMTP Connection Manager
  4. Click on Test Connection to check configure correct.
  5. Click on OK button to save SMTP connection configure setting UI.

How to create Variables and OLE DB connection.

  1. Let's Create Variables, In Visual Studio Right Click on Design Panel, Select Variables.
    SFTP Task Operations - Create Variable
  2. Create Variable varResult with Object DataType, use following image.
    Send HTML Email Task - Create Variable
  3. Now, lets create OLE DB Connection.
  4. Let's, Right click on Connection Managers Panel to Create OLEDB Connection, so you can use Source and Context Menu will appear, Select New OLEDB Connection from the Context Menu.
    SSIS OLEDB - Connection
  5. Now, click on New Button for create Connection.
    SSIS OLEDB - Connection
  6. Let's Configure Connection Manager, just Follow steps one by one as we have created.
    SSIS OLEDB - Connection
  7. Click on OK button to save connection configure setting UI.

How to send email using HTML Email Task.

  1. Double click on Execute SQL Task to configure it.
  2. In the General Tab, set ResultSet to Full result set and connection type to OLE DB. Select connection and write SQL Query.
    SSIS Send HTML Email Task
  3. In the Result Set Tab, click on Add button and Set Result Name as 0 and select your desired object type variable we have created before.
    SSIS Send HTML Email Task
  4. Click on OK button to save Execute SQL Task configure setting UI.
  5. Now, double click on HTML Email Task to configure it.
  6. Select SMTP connection we have created before. In General Tab enter correct information. In the body content Select variable and placeholder.
    SSIS Send HTML Email Task - ssis sending results as body of email
  7. Now, you can Edit email Style if you want.
    SSIS Send HTML Email Task- Edit CSS Style
  8. Now, click on Preview button to see Email Preview.
    ssis send mail task with html body
  9. Click on OK button to save HTML Email Task configure setting UI.
  10. Thats all, SSIS Send HTML Email Task - Email Sent (See recordset variable turned into HTML Table, See how date and Currency formatted)
    SSIS Send HTML Email Task

Properties

Property Name Description
SmtpConnection Specifies SMTP connection manager for sending email
IsHtmlEmail Specifies whether email is in Plain Text or HTML format
DefaultStyle Default CSS Style for tables generated from recordset. Set this according to your need.
Subject Specifies subject line of email
From Specifies FROM address for email.
To Specifies TO address for email. Can be comma separated if you have multiple email addresses.
Cc Specifies CC address for email. Can be comma separated if you have multiple email addresses.
Bcc Specifies BCC address for email. Can be comma separated if you have multiple email addresses.
Attachments Specifies file(s) you want to attach with your email. Use vertical bar if you want to attach multiple files
EmailPriority Specifies email priority
MessageSourceType Specifies how to read email body text. It can be from variable, from file or direct input
MessageDirectValue Specifies email body text. Only applicable when MessageSource is DirectValue.
MessageFileConnection Specifies connection which points to the email template file path. Only applicable when MessageSource is Connection.
MessageVariable Specifies SSIS variable name which holds email body text. Only applicable when MessageSource is Variable.
LoggingMode LoggingMode determines how much information is logged during Package Execution. Set Logging mode to Debugging for maximum log.

Setting UI

SSIS Send HTML Email Task - Setting UI
SSIS Send HTML Email Task - Setting UI

See Also

Articles / Tutorials


Copyrights reserved. ZappySys LLC.