Scripting Database Mail Configuration

  • Hi Experts,

    Is it possible to script out the database mail configured in server?

    Thanks In Advance

  • All the data you need is in msdb, in the following tables for the most part:

    msdb.dbo.sysmail_server

    msdb.dbo.sysmail_account

    msdb.dbo.sysmail_configuration

    msdb.dbo.sysmail_principalprofile

    msdb.dbo.sysmail_profile

    msdb.dbo.sysmail_profileaccount

    Based on the values in those tables you would want to create a script that executed the following stored procedures:

    msdb.dbo.sp_add_operator

    msdb.dbo.sysmail_add_account_sp

    msdb.dbo.sysmail_add_profile_sp

    msdb.dbo.sysmail_add_profileaccount_sp

    msdb.dbo.sp_set_sqlagent_properties

    master.dbo.xp_instance_regwrite

    Regards,

    Toby

  • Thanks Toby

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

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