send email of all defaulters

  • Hi,

    Please help on below scenario to send mail.

    I am having a table which contains student attendance. If student is absent then the mail should automatically goes to HOD. But issue is that i don't want to send mail one for each student.

    Suppose there is maths department and 7 students are absent then all 7 students name i want to send to HOD by the mail. I am able to send but 7 mails are going. Can you please help? its urgent.

    Thanks

    Abhas

  • you can use the procedure to first have the list of students

    absent in a particular department and then use the procedure

    sp_send_dbmail to send the list of absentees in the mail.

  • Hi Jeet,

    I want to use this by using SSIS.

    Thanks

    Abaso jadhav

  • abhas (12/4/2012)


    Hi Jeet,

    I want to use this by using SSIS.

    Thanks

    Abaso jadhav

    Store the names of student in string variable using Execute Sql Task and then use send mail task to send mail.

  • Hi rhythm

    I am doing the same but emails are going repeatedly.

    Example if there are 5 students then 5 different mails are going.

    Thanks

    Abhas.

  • abhas (12/5/2012)


    Hi rhythm

    I am doing the same but emails are going repeatedly.

    Example if there are 5 students then 5 different mails are going.

    Thanks

    Abhas.

    Probably you have include your mail task in loop container or so.

    Please check and if not then attach screenshots or explain your package ?

  • Hi rhythm,

    I am doing below steps.

    1) Execute sql task - here I am fetching studid,studname,deptname,HodName,HodMail.

    2) I am using foreach loop

    3) In foreach loop I am using script task and sendmail task

    In script task I am fetching mailid's and writting body of message. But what happens in this case suppose there are 3 students belongs to physics dept then 3 separate mails are going to HOD.

    I want to send single mail for three students as;

    Dear Sir,

    student1,student2,student3 are absent today.Please take required action.

    Thanks

    Abaso Jadhav

  • abhas (12/5/2012)


    Hi rhythm,

    I am doing below steps.

    1) Execute sql task - here I am fetching studid,studname,deptname,HodName,HodMail.

    2) I am using foreach loop

    3) In foreach loop I am using script task and sendmail task

    In script task I am fetching mailid's and writting body of message. But what happens in this case suppose there are 3 students belongs to physics dept then 3 separate mails are going to HOD.

    I want to send single mail for three students as;

    Dear Sir,

    student1,student2,student3 are absent today.Please take required action.

    Thanks

    Abaso Jadhav

    Thats what I doubted.Use send mail task outside for each loop.

    I hope you are using package level variable for stroing email ids.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply