MS SQL DB Mail 추가 스크립트

-- Create a Database Mail profile 
EXECUTE msdb.dbo.sysmail_add_profile_sp 
@profile_name = 'SQL2005_Email_ProfileName', 
@description = 'Notification service for SQL Server' ; 

-- Create a Database Mail account 
EXECUTE msdb.dbo.sysmail_add_account_sp 
@account_name = 'SQL Server Notification Service', 
@description = 'SQL Server Notification Service', 
@email_address = 'john.doe@domain_name.com', 
@replyto_address = 'john.doe@domain_name.com', 
@display_name = 'SQL Server Notification Service', 
@mailserver_name = 'smtpserver.domain_name.com' ; 

-- Add the account to the profile 
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp 
@profile_name = 'SQL2005_Email_ProfileName', 
@account_name = 'SQL Server Notification Service', 
@sequence_number =1 ; 

-- Grant access to the profile to the DBMailUsers role 
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp 
@profile_name = 'SQL2005_Email_ProfileName', 
@principal_id = 0, 
@is_default = 1 ; 

SELECT * FROM msdb.dbo.sysmail_profile 
SELECT * FROM msdb.dbo.sysmail_account

댓글

이 블로그의 인기 게시물

Slug가 뭘까?

[MS SQL] SP수행 시간 및 작업빈도 확인

django 예제 따라하기 (투표 앱 개발) 요약 Part 3,4