Click here to Skip to main content
15,995,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 25-Sep-12 4:26am
v2

1 solution

use script task to send emails: a sample:

C#
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);
        }

For scheduling packages, create SQL Server Agent jobs and schedule it.

There are many advantages for SSIS, google it.
 
Share this answer
 
Comments
Prathap Gangireddy 25-Sep-12 11:59am    
Thank you dude.

Can you also Also explain if there is any advantage of using SSIS instead of C# code in Windows Scheduler

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900