Configure SQL Server Agent Mail to Use Database Mail (T-SQL?)

  • Jon.Morisi

    SSChampion

    Points: 12845

    Is there any way to accomplish this via T-SQL?

    http://msdn.microsoft.com/en-us/library/ms189684.aspx

    To set up SQL Server Agent Mail to use Database Mail

    1.In Object Explorer, expand a server.

    2.Right-click SQL Server Agent, and then click Properties.

    3.Click Alert System.

    4.Select Enable Mail Profile.

    5.In the Mail system list, select Database Mail.

    6.In the Mail profile list, select a mail profile for Database Mail.

    7.Restart SQL Server Agent.

  • Sioban Krzywicki

    One Orange Chip

    Points: 27769

    This should be a good starting place for you

    http://msdn.microsoft.com/en-us/library/ms175862.aspx

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • SQLRNNR

    SSC Guru

    Points: 281210

    Yes.

    USE [msdb]

    GO

    EXEC msdb.dbo.sp_set_sqlagent_properties @email_save_in_sent_folder=1

    GO

    EXEC master.dbo.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'UseDatabaseMail', N'REG_DWORD', 1

    GO

    EXEC master.dbo.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'DatabaseMailProfile', N'REG_SZ', N''

    GO

    This code was retrieved by hitting the script button on the Agent Properties Alert System screen.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Jon.Morisi

    SSChampion

    Points: 12845

    Thanks!

  • SQLRNNR

    SSC Guru

    Points: 281210

    You're welcome.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 5 posts - 1 through 5 (of 5 total)

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