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

  • 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.

  • 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

  • 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

  • Thanks!

  • 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 4 (of 4 total)

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