Send mail task in SSIS

Hello friends, today we will learn about “Send mail task” in SSIS. Let’s get into details without wasting a moment. First of all we will take “Send mail task” in control flow region (As shown in the below screenshot).


To configure the “Send mail task”, we will right click on it and click on “Edit” menu that will bring a new screen to us( As shown in the below screenshot).


In the above screenshot, we can see that I have selected the “Mail” tab. To configure the “Send mail task”, we need to provide all the details in this section. first of all we will configure the “SMTP connection” by clicking on the combo box item “New connection” (As shown in the above screenshot).

As soon as we click on the “New connection” item, a new screen will come up (Shown below).


In the above window, we can give the name to our “SMTP Connection Manager” , I have given name “Mail send task”. In the description field I have written “This task will send an email”. In the “SMTP Server” field , we have to provide the “SMTP Server Name” .  Connection manager only supports windows authentication and anonymous authentication, it doesn't support basic authentication. Using second check-box option(enable secure sockets layer), we can secure our communication. We will click on “OK” button to close the above window. Now we are back to the previous screen.


In the above screen, we need to provide following details to configure the “Send mail task” completely.
From :- Provide the email id through which we want to send our mails(that email id should exists on SMTP Server).
To, CC and BCC:- We can provide the recipients list and similarly “CC List” and “BCC List”.
Subject:- In subject field we can write the subject line of the email.
Message Source Type:-Message Source type” field consists of three items (Direct Input, File connection, Variable), In this field, we define what will be the source of email body.below are the details for each type of message.
Direct Input:- If we select direct input, in that case we need to write down the email content in a text box.Lets take an example by selecting the “Message source type” as Direct input. After selecting the “Direct input” option, In the next field “Message source”  there is a small button(encircled by red color). We will click on that button.


As soon as we click on the button, a new pop up window will appear, in that window we will write down the email content(Please refer below screenshot for your reference).


We will click on “OK” button to close the “Message source” window.
File Connection:- If we select File connection option in the “Message Source Type”, then we need to specify a text file from which “Send mail task” will read the email content.
Variable:- If we select Variable option in the “Message Source type”, then we need to specify a variable that contains the email content.
We can also specify the priority of email in the “Priority” field and using attachment field we can provide the file path of an attachment that can be sent by the “Send mail task”. We will click on “OK” button after specifying all the details.

I hope you will find this article useful , keep reading my blog and please post your comments if you have any questions.


No comments: