Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Sending Mail In SSIS Using Script Task- Simpler and Flexible Approach Expand / Collapse
Author
Message
Posted Wednesday, May 6, 2009 7:40 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, 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.
Post #711065
Posted Wednesday, May 6, 2009 7:49 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, Visits: 98
I posted the images also with the article.
What should I do now? Shall I post the article again to contribution center.
Post #711077
Posted Wednesday, May 6, 2009 7:53 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, March 30, 2012 11:04 AM
Points: 13, Visits: 40
with out the images, your article doesn't hold water.
Please repost, with pics.
Thanks
Post #711079
Posted Wednesday, May 6, 2009 7:58 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 10, 2013 4:31 PM
Points: 49, Visits: 135
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.
Post #711084
Posted Wednesday, May 6, 2009 8:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 16, 2011 8:44 AM
Points: 1, Visits: 7
Without images it is not very helpful, please repost them.
Post #711117
Posted Wednesday, May 6, 2009 8:21 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, Visits: 98
I have resubmitted the article with images to contribution center.How will it be updated?
Post #711119
Posted Wednesday, May 6, 2009 8:21 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, June 24, 2014 2:03 PM
Points: 30, 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!
Post #711121
Posted Wednesday, May 6, 2009 8:50 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, 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
Post #711165
Posted Wednesday, May 6, 2009 9:00 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 10, 2013 4:31 PM
Points: 49, Visits: 135
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.
Post #711185
Posted Wednesday, May 6, 2009 9:01 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, February 14, 2013 2:48 PM
Points: 23, Visits: 144
No images - check what you post.
Post #711186
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse