Solved

Send Mail Task migrating from DTS to SSIS

Posted on 2009-05-14
2
553 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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.
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.

815 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

11 Experts available now in Live!

Get 1:1 Help Now