Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Send Mail Task migrating from DTS to SSIS

Posted on 2009-05-14
2
Medium Priority
?
571 Views
Last Modified: 2013-11-10
I have migrated a package from DTS to SSIS.  The Send Mail Task sends email to an Outlook group. This worked in DTS, but SSIS is asking for actual email addresses.  How can I send to a group?
0
Comment
Question by:nordicgirl
2 Comments
 
LVL 13

Accepted Solution

by:
TommyTupa earned 2000 total points
ID: 24451683
Most groups have an email alias for example the SMTP address for example our DL-DBAGroup is DBAAdmins@MyCompany.com.  I then use a script task such as below to send mail.  Here is a discussion on the topic: http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/7bde3030-491c-4ab7-ad9e-02ca5abad17b/


Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Net.Mail


Public Class ScriptMain

    Public Sub Main()

        Dim mailServer As String = "MyMailServer"
        Dim fromAddress As String = "SQLServerNotification@MyCompany.com"
        Dim toAddress1 As String = "DBAGroup@MyCompany.com"
        Dim toAddress2 As String = "Person@MyCompany.com"
        Dim subject As String = "This is my subject: " & CStr(Today)
        Dim body As String
        Dim fileName As String = "c:\file.csv"


     
            body = "Please find todays file attached. The file contains checks job failures from the previous business

        Dim smtp As New SmtpClient(mailServer)
        Dim message As New MailMessage(fromAddress, toAddress1, subject, body)
        message.To.Add(New MailAddress(toAddress2))

       message.Attachments.Add(New Attachment(fileName))

        smtp.Send(message)


        Dts.TaskResult = Dts.Results.Success


    End Sub
End Class
0
 

Author Closing Comment

by:nordicgirl
ID: 31581503
thank you!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question