2011年4月7日 星期四

轉貼...Database Mail 送出html tabular 郵件

之前用FOR XML PATH組出一個COLUMN多筆資料變成一筆...

這次再次見識他的強大...

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 ;



 

沒有留言:

張貼留言

IIS 網站無法下載中文檔名檔案因為取消高位元字元

 網址+中文檔案名稱方式下載檔案顯示 404 - 找不到檔案或目錄。 但英數字檔案名稱則可下載。 因為設定GCB IIS,其中1項 將高位元字元預設取消勾選了。 27 TWGCB-04-014-0028 要求篩選與其他限制模組 允許高位元字元 這項原則設定決定查詢...