我有一个带有列的表 用户名,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包发送邮件
发布评论