這次再次見識他的強大...
Send email in a tabular format using SQL Server database mail
Database Mail設定
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO
-- Create a Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'Bev',
@description = 'Mail account for test e-mail.',
@email_address = 'test@test.com',
@replyto_address = null,
@display_name = 'Beverly',
@mailserver_name = 'test.com' ;
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'Hinet',
@description = 'Profile used for test mail.' ;
-- Add the account to the profile (一個profile可有多個account)
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'Hinet',
@account_name = 'Bev',
@sequence_number =1 ;
-- Grant access to the profile to the DBMailUsers role
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@principal_name = 'public',
@profile_name = 'Hinet',
@is_default = 1 ;
沒有留言:
張貼留言