使用SSIS包发送邮件

编程入门 行业动态 更新时间:2024-10-27 04:31:18
本文介绍了使用SSIS包发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个带有列的表 用户名,EmailId,加入日期,地址. 因此,我想使用此数据来计划一个每周运行一次的工作(例如:星期日),并且必须将邮件发送给用户以加入其加入日期在特定日期之间的组织. 如果我是SSIS的新手,谁可以请提供完整的描述以及屏幕截图. 还请说明在Windows Scheduler中使用SSIS代替C#代码有什么优势. (即放置dll) 谢谢. 问候, Prathap

Hi, I have a table with the columns Username,EmailId,JoiningDate,Address. So using this data i would like to schedule a job which runs once in a week(eg:sunday) and the mail has to be sent to the users to join the organisation whose joining date is between particular dates. Can anyone please provide a complete description with screenshots if possible as I am new to SSIS. Also explain is there any advantage of using SSIS instead of C# code in Windows Scheduler (i.e. placing the dll) Thank you. Regards, Prathap

推荐答案

使用脚本任务发送电子邮件:示例: use script task to send emails: a sample: public void Messager(string MessagingSubjectLine, string Report, string To, string From, string LogFileLocation, string ExecutionSummary) { string conn = Dts.Connections["SMTP_Conn"].AcquireConnection(null) as string; conn = conn.Split(new char[] { '=', ';' })[1]; MailMessage varHTMLMail=new MailMessage(); if (To.Split(';').Length > 1) { string[] amto = To.Split(';'); foreach (string s in amto) varHTMLMail.To.Add(s); } else varHTMLMail.To.Add(To); varHTMLMail.From = new MailAddress(From); SmtpClient varSMTPClient; varHTMLMail.Subject = MessagingSubjectLine + "Completed"; varHTMLMail.Body = Report; varHTMLMail.Priority = MailPriority.Normal; varHTMLMail.IsBodyHtml = true; varSMTPClient = new SmtpClient(conn); varSMTPClient.UseDefaultCredentials = true; varSMTPClient.Timeout = 100000 * 6; varSMTPClient.Send(varHTMLMail); }

对于计划程序包,请创建SQL Server代理作业并对其进行计划. google,SSIS有很多优点.

For scheduling packages, create SQL Server Agent jobs and schedule it. There are many advantages for SSIS, google it.

更多推荐

使用SSIS包发送邮件

本文发布于:2023-10-27 16:17:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533897.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:发送邮件   SSIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!