Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Send Mail Task migrating from DTS to SSIS

Posted on 2009-05-14
2
554 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
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

828 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