exec sp_smtp_sendmail question

  • exec sp_smtp_sendmail @FROM=myname@mycompany.org',

    @FROM_NAME='SQLLAB02',

    @TO=myname@mycompany.org,

    @subject='Email notifications for failed jobs',

    @message='email notifications for failed SQL Server jobs',

    @server='123.16.4.47'

    I am using the above code as a second step on my maintenance jobs to so email notifications when the job fails. I can't for the life of me figure out how to add a second email address???

    I'd like the email to go to both sql server dbas but I can't figure out the syntax. can anyone help?

  • Use this:

    declare @rc int

    exec @rc = master.dbo.xp_smtp_sendmail

    @FROM = N'servername@domain.com',

    @TO = N'emailaddress',

    @cc = N'emailaddress',

    @priority = N'HIGH',

    @Subject = N'Job failure',

    @Message = N'Message',

    @server = N'emailserver'

  • Jpotucek (3/27/2008)

    I am using the above code as a second step on my maintenance jobs to so email notifications when the job fails. I can't for the life of me figure out how to add a second email address???

    Use a semicolon between the addresses. Looks like a couple parameters are missing single quotes too.

    ex.

    @TO='user1@mycompany.org;user2@mycompany.org'

  • Thank you both very much

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply