Solved

Send Mail Task migrating from DTS to SSIS

Posted on 2009-05-14
2
549 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 500 total points
Comment Utility
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
Comment Utility
thank you!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now