Receive Mail Task

SQL Server 2005, 2008, 2008R2, 2012, 2014

SQL Server 2005, 2008, 2008R2, 2012, 2014

All Downloads ----- Questions?

Overview

The Receive Mail Task is an SSIS Control Flow task for receiving e-mails. The task can also decrypt and verify signatures of S/MIME e-mails.


Demonstration

Demonstration VideoDemonstration Video

Setup

Use the General page of the Receive Mail Task Editor dialog to configure the parameters needed to receive e-mails.

Parameters

Name

Specify the task name.

Description

Specify the task description.

StopOnFailure

Specify whether or not the Receive Mail Task terminates if the chosen action fails.

Action

Specify the task action. This parameter has the options listed in the following table.

Option Description
Get mail Downloads mail to a local file. Selecting this action displays the dynamic parameters IsLocalVariable, Local, LocalVariable, OverwriteExisting, MailConnection, MailVariable.
Open mail Opens the mail file. Selecting this action displays the dynamic parameters IsLocalVariable, Local, LocalVariable, Decrypt, VerifySignature, IsSenderVariable, Sender, SenderVariable, IsDateVariable, Date, DateVariable, IsSubjectVariable, Subject, SubjectVariable, IsBodyTextVariable, BodyText, BodyTextVariable, IsBodyHtmlVariable, BodyHtml, BodyHtmlVariable, IsAttachmentVariable, Attachment, AttachmentVariable.
Delete mail Deletes the mail. Selecting this action displays the dynamic parameters MailConnection, MailVariable.
Get mail list Gets a list of e-mails. Selecting this action displays the dynamic parameters ResultVariable, MailConnection, IsFilterVariable, Filter, FilterVariable.
IsLocalVariable

Indicate whether or not the local path is stored in a variable. This parameter has the options listed in the following table.

Option Description
True The local path is stored in a variable. Selecting this option displays the dynamic parameter LocalVariable.
False The local path is specified in a File connection manager. Selecting this option displays the dynamic parameter Local.
Local

Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

LocalVariable

Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

OverwriteExisting

Specify whether or not an existing local file can be overwritten with the received mail. This parameter has the options listed in the following table.

Option Description
True If an existing local file exists, it will be overwritten by the received mail.
False If an existing local file exists, it will not be overwritten by the received mail and a warning message will be generated in the log file.
MailConnection

Select an existing POP3 connection manager or IMAP connection manager, or click <New connection...> to create a new connection manager.

Related Topics: POP3 Connection Manager, IMAP Connection Manager

MailVariable

Mail information object. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

Decrypt

Indicate whether or not the mail must be decrypted. This parameter has the options listed in the following table.

Option Description
True The mail must be decrypted. Selecting this option displays the dynamic parameters IsPrivateKeyVariable, PrivateKey, PrivateKeyVariable, Password.
False The mail is not encrypted so it need not be decrypted.
IsPrivateKeyVariable

Indicate whether the file path of the private key is stored in a variable. This parameter has the options listed in the following table.

Option Description
True The file path of the private key is stored in a variable. Selecting this option displays the dynamic parameter PrivateKeyVariable.
False The file path of the private key is specified in a File connection manager. Selecting this option displays the dynamic parameter PrivateKey.
PrivateKey

Specify the File connection manager where the file path of the private key is specified. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

PrivateKeyVariable

Specify the variable where the file path of the private key is specified. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

Password

Specify the private key password.

VerifySignature

Indicate whether or not the mail signature must be verified. This parameter has the options listed in the following table.

Option Description
True Verify the mail signature. Selecting this option displays the dynamic parameters , IsCertificateVariable, Certificate, CertificateVariable.
False Do not verify the mail signature.
IsCertificateVariable

Indicate whether or not the file path of the certificate is stored in a variable. This parameter has the options listed in the following table.

Option Description
True The file path of the certificate is stored in a variable. Selecting this option displays the dynamic parameter CertificateVariable.
False The file path of the certificate is specified in a File connection manager. Selecting this option displays the dynamic parameter Certificate.
Certificate

Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

CertificateVariable

Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsSenderVariable (1.5 SR-3)

Indicate whether or not the sender of the mail should be stored in a variable. This parameter has the options listed in the following table.

Option Description
True The sender of the mail should be stored in a variable. Selecting this option displays the dynamic parameter SenderVariable.
False The sender of the mail should be stored in a file and is specified in a File connection manager. Selecting this option displays the dynamic parameter Sender.
Sender (1.5 SR-3)

Specify the file where the sender of the mail should be stored. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

SenderVariable (1.5 SR-3)

Specify the variable where the sender of the mail should be stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsDateVariable (1.5 SR-3)

Indicate whether or not the origination date of the mail should be stored in a variable. This parameter has the options listed in the following table.

Option Description
True The origination date of the mail should be stored in a variable. Selecting this option displays the dynamic parameter DateVariable.
False The origination date of the mail should be stored in a file and is specified in a File connection manager. Selecting this option displays the dynamic parameter Date.
Date (1.5 SR-3)

Specify the file in which the origination date of the mail should be stored. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

DateVariable (1.5 SR-3)

Specify the variable in which the origination date of the mail should be stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsSubjectVariable

Indicate whether or not the subject line of the mail should be stored in a variable. This parameter has the options listed in the following table.

Option Description
True The subject line of the mail should be stored in a variable. Selecting this option displays the dynamic parameter SubjectVariable.
False The subject line of the mail should be stored in a file and is specified in a File connection manager. Selecting this option displays the dynamic parameter Subject.
Subject

Specify the file in which the subject line of the mail should be stored. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

SubjectVariable

Specify the variable in which the subject line of the the mail should be stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsBodyTextVariable

Indicate whether or not the text of the body of the mail should be stored in a variable. This parameter has the options listed in the following table.

Option Description
True The text of the body of the mail should be stored in a variable. Selecting this option displays the dynamic parameter BodyTextVariable.
False The text of the body of the mail should be stored in a file and is specified in a File connection manager. Selecting this option displays the dynamic parameter BodyText.
BodyText

Specify the file in which the text of the body of the mail should be stored. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

BodyTextVariable

Specify the variable in which the text of the body of the mail should be stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsBodyHtmlVariable

Indicate whether or not the HTML of the body of the mail should be stored in a variable. This parameter has the options listed in the following table.

Option Description
True The HTML of the body of the mail should be stored in a variable. Selecting this option displays the dynamic parameter BodyHtmlVariable.
False The HTML of the body of the mail should be stored in a file and is specified in a File connection manager. Selecting this option displays the dynamic parameter BodyHtml.
BodyHtml

Specify the file where the HTML of the body of the mail should be stored. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

BodyHtmlVariable

Specify the variable where the HTML of the body of the mail should be stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsAttachmentVariable

Indicate whether or not the mail attachments folder is stored in a variable. This parameter has the options listed in the following table.

Option Description
True The mail attachments folder should be stored in a variable. Selecting this option displays the dynamic parameter AttachmentVariable.
False The mail attachments folder should be specified in a File connection manager. Selecting this option displays the dynamic parameter Attachment.
Attachment

Specify the File connection manager in which the mail attachments folder should be specified. Select an existing File connection manager, or click <New connection...> to create a new connection manager.

Related topics: File Connection Manager Editor

AttachmentVariable

Specify the variable in which the mail attachments folder should be specified. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

ResultVariable

Specify the variable where the returned list of mail should be stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

IsFilterVariable

Indicate whether the mail filter criteria is stored in a variable. This parameter has the options listed in the following table.

Option Description
True The mail filter criteria is stored in a variable. Selecting this option displays the dynamic parameter FilterVariable.
False The mail filter criteria is directly specified. Selecting this option displays the dynamic parameter Filter.
Filter

Specify the mail filter criteria. The filter expression for each connection type is as follows:

Connection Description
POP3

FLEE expression. You can use the following elements: ID, Date, Size, From, To, CC, ReplyTo, Subject, BodyText, BodyHtml, HasAttachments.

For example, to get all e-mails after 10 Sep 2009 containing "data" in the subject line, use the following expression: date > #09/10/2009# and subject.contains("data")

Note: Because the filter process is done on the client side, be careful what elements you use in your expressions. Using BodyText, BodyHtml and HasAttachments elements will require complete mail retrieval.

IMAP IMAP SEARCH COMMAND expression.
EXCHANGE (1.6) Exchange AQS expression.
FilterVariable

Specify the variable in which the mail filter criteria is stored. Select an existing user-defined variable, or click <New variable...> to create a new variable.

Related Topics: Integration Services Variables, Add Variable

Related scripts

Samples

  • For a sample showing how to process and iterate over mail information, check this package.
  • Email Attachment Harvesting using COZYROC SSIS+ by Greg Troyan.