SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Sending Mail In SSIS Using Script Task- Simpler and Flexible Approach


Sending Mail In SSIS Using Script Task- Simpler and Flexible Approach

Author
Message
Manish Sinha
Manish Sinha
Old Hand
Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)

Group: General Forum Members
Points: 327 Visits: 98
Yes. while sending mail, you can store sent datetime and To address in database or log it in a text file using variables used for these field values.
Manish Sinha
Manish Sinha
Old Hand
Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)

Group: General Forum Members
Points: 327 Visits: 98
I posted the images also with the article.
What should I do now? Shall I post the article again to contribution center.
michael hickman
michael hickman
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 40
with out the images, your article doesn't hold water.
Please repost, with pics.
Thanks
Brett Flippin
Brett Flippin
SSC-Enthusiastic
SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)

Group: General Forum Members
Points: 175 Visits: 164
I agree with the earlier post saying this is MUCH more easily done with a Send Mail task and expressions. You're doing nothing but replicating functionality already built into Send Mail task.

I'd say the simplest and easiest way to do something would be to take advantage of the tools given instead of reinventing the wheel.
Sasidhar Chavali
Sasidhar Chavali
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 7
Without images it is not very helpful, please repost them.
Manish Sinha
Manish Sinha
Old Hand
Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)

Group: General Forum Members
Points: 327 Visits: 98
I have resubmitted the article with images to contribution center.How will it be updated?
Mathew Michuta
Mathew Michuta
SSC Journeyman
SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)SSC Journeyman (90 reputation)

Group: General Forum Members
Points: 90 Visits: 119
I disagree that it is easier to send mail from inside a script task.

I use a script task to set addresses, conditionally attach multiple files, modify the content of the email, etc, then use expressions inside the send mail task. This makes it much easier to see the program flow at a glance, and ADD to the email from multiple places within your package before being sent.

An error from a send mail task is much easier to decipher than an error inside a script task, too!:-D
Manish Sinha
Manish Sinha
Old Hand
Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)

Group: General Forum Members
Points: 327 Visits: 98
The article mentions that using script task is simpler if the required mail functionality is complex.
Example: I need to send to 100 recipients one by one with different messages and subjects. I also need to store in database or create a text file having the datetime and email addresses for all the mails sent.This is small example.You can do number of things using script task.

I do not say it's always simpler..........It depends on functionality you need :-)
Brett Flippin
Brett Flippin
SSC-Enthusiastic
SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)

Group: General Forum Members
Points: 175 Visits: 164
It sounds like from that example that you could do that with For or Foreach Loop container to loop through your emails and do the appropriate operations instead of maybe embedding that logic in a script task.

This is the beauty of SSIS, Microsoft has provided us a rich tool to do work the way we want to.

In my opinion and personal best practice, a script task is a last resort to add functionality that isn't already present in SSIS. They aren't as maintainable in the long run, and they obfuscate their true function in the package by being able to execute any number of operations that maybe aren't detailed in the task's name or some comments.
castspeller
castspeller
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 144
No images - check what you post.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search