How to attach multiple files in the Send Mail Task in SSIS
Let’s say you need to create a SSIS package that creates 2 files and emails the files to someone.
Your package may look something like this:
Double-click the Send Mail Task to open the Send Mail Task Editor (shown below).
Fill in all the relevant fields, such as To, Subject, etc.
Click in the Attachments text area, and then click the “ellipsis button” to open the file dialog. Navigate to and select the files you need. You can do this multiple times if necessary to add all the files you need.
Note that when multiple files are attached, SSIS will automatically put a vertical bar/pipe character (“|”) between each file. However, chances are if that’s all you needed to do you would just do it via Outlook and be done.
It is likely that you need to make this dynamic, so that you can automate your process to automatically create and name your files dynamically, and then attach the files to the email. For this, you will need to use Expressions to create your files, and to set the “FileAttachements” property.
To make your filenames dynamic, click the Expressions ellipsis in the Properties pane for the Connection Manager for the file.
Choose the “ConnectionString” property and then set the Expression in the Expression Builder.
In the example below, the current date is added to the end of the File1, so that each day when your package runs, you will have a different filename – for example, File1_20110519, File1_20110520, and so on.
So, now that you have dynamic filenames, you need to make your Send Mail task’s “FileAttachments” property dynamic.
Open the Send Mail Task editor by double clicking on the Send Mail Task.
Click the Expressions option on the left-hand side of the Task Editor.
Click in the text box to the right of Expressions and then click the “ellipsis button”.
Select the “FileAttachments” Property and then click the ellipsis button to open the Expression Builder.
So, let say you needed to attach the 2 files, File1_yyyymmdd.txt and File2_yyyymmdd.txt where yyyymmdd is the current date.
Create your Expression to be something like this:
You could have also created a package variable that stores the current date in the format yyyymmdd and use the variable instead of the long expression above. For example, if you derived the date and stored in a variable called User::TodaysDate, then your “Fileattachment” expression would look something like this:
“C:\\Projects\\File1_” + @[User::TodaysDate] + “|” + “C:\\Projects\File2_” + @[User::TodaysDate]
How to attach multiple files in the Send Mail Task in SSIS的更多相关文章
- SSIS Send Mail
在SSIS中Send Mail的方法主要有三种,使用Send Mail Task,使用Script Task和使用存储过程msdb.dbo.sp_send_dbmail. 一,使用Send Mail ...
- Uploading multiple files asynchronously by blueimp jquery-fileupload
Uploading multiple files asynchronously by blueimp jquery-fileupload Solved. Fiddle: http://jsfidd ...
- 基于Picture Library创建的图片文档库中的上传多个文件功能(upload multiple files)报错怎么解决?
复现过程 首先,我创建了一个基于Picture Library的图片文档库,名字是 Pic Lib 创建完毕后,我点击它的Upload 下拉菜单,点击Upload Picture按钮 在弹出的对话框中 ...
- How to effectively work with multiple files in Vim?
Why not use tabs (introduced in Vim 7)? You can switch between tabs with :tabn and :tabp, With :tabe ...
- Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/lidroid/xutils/task/TaskHandler;
Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files defi ...
- How to Upload multiple files to documentLibrary in one time
In a Sharepoint 2013 website,we can upload one file to the documentlibrary by click "Uploa ...
- mailsend - Send mail via SMTP protocol from command line
Introduction mailsend is a simple command line program to send mail via SMTP protocol. I used to sen ...
- 发送邮件的三种方式:Send Mail Message
发送邮件的三种方式: 1.VBS 执行vbs脚本文件的程序为: system32文件下的 NameSpace = "http://schemas.microsoft.com/cdo/conf ...
- [SCSS] Organize SCSS into Multiple Files with Partials
Tired of dealing with monolithic CSS files? Are requests for multiple CSS files hurting your perform ...
随机推荐
- pyqt5--QTDesigner--安装与配置
安装: 安装PyQt5-tools 文件--->设置---> ---> 安装之后在 安装目录\Lib\site-packages\pyqt5_tools 找到 designer.e ...
- Python---项目需求分析
一.软件工程 .软件工程:工程化方法解决软件问题 操作步骤 1.需求分析 前台:给基础用户使用的页面 后台:给操作者/admin等使用的页面系统 不是服务器前后台概念 2.小米前台 商品展示 商品详情 ...
- Vue3.0 Function API---------引用
1.了解 Vue 3.0 是否有 break change,就像 Python 3 / Angular 2 一样? 不,100% 兼容 Vue 2.0,且暂未打算废弃任何 API(未来也不).之前有草 ...
- SQLite为何要用C语言来开发?
SQLite 选择 C 语言的理由是?为什么不选择 Go 或者 Rust? C 语言是最好的 SQLite 在 2000 年 5 月 29 日发布,并一直使用 C 语言实现.C 语言一直是实现 SQL ...
- 51nod 1228 序列求和(伯努利数)
1228 序列求和 题目来源: HackerRank 基准时间限制:3 秒 空间限制:131072 KB 分值: 160 难度:6级算法题 收藏 关注 T(n) = n^k,S(n) = T(1 ...
- PISCES: A Programmable, Protocol-Independent Software Switch
Name of article:PISCES: A Programmable, Protocol-Independent Software Switch Origin of the article:S ...
- jQuery_完成表格的隔行换色
表格的颜色一样不利于区分,而利用jQuery则可以很方便的进行表格的隔行换色操作,原表如下: 这样看着很不方便,但是隔行换色之后非常便捷清楚. 代码如下: <!DOCTYPE html> ...
- Eclipse通过JDBC连接MySQL数据库的步骤(最原始的几个步骤)
java可以兼容目前市面上所有类型的数据库,主要是因为提供了两个接口,一个用于连接目标数据库,一个用于向数据库中传输SQL命令. Connection接口——连接目标数据库: Statement 接 ...
- 如何隐藏scroll-Y纵向滚动条,并不影响内容滚动的方法
网上搜了很多关于隐藏滚动条的文章,发现很多都是只说了如何隐藏scroll-X横向滚动条,对scroll-Y纵向滚动条并没有明确的述说.本文章将介绍3种隐藏滚动条的方法,大家可以结合实际情况,参考文章内 ...
- Java文件中代码
public class MyTextView extends TextView { //在用代码创建的时候调用 public MyTextView(Context context) { this(c ...