-- Create a Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_ sp
@account_name = 'account_name',
@description = '',
@email_address = 'mail@mail.com',
@replyto_address = 'mail@mail.com',
@display_name = 'Display_Name',
@mailserver_name = '10.200.10.10';
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_ sp
@profile_name = 'MyProfile',
@description = 'Profile for bla bla bla';
-- Add the account to the profile
EXECUTE msdb.dbo.sysmail_add_ profileaccount_sp
@profile_name = 'MyProfile',
@account_name = 'account_name',
@sequence_number = 1 ;
-- Grant access to the profile to the DBMailUsers role
EXECUTE msdb.dbo.sysmail_add_ principalprofile_sp
@profile_name = 'MyProfile',
@principal_name = 'guest',
@is_default = 0; -- or 1
No comments:
Post a Comment