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 ;



 

沒有留言:

張貼留言

publish error allowDefinition='MachineToApplication'

一個老舊的aspx web form專案,調了一些功能建置成功,但進行部署時顯示以下錯誤。 在應用程式層級之外使用註冊為 allowDefinition='MachineToApplication' 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為...