2016-04-20 20 views

回答

1

Here是一個詳細介紹過程的博客。

以下是博客內容的粗略副本,以便將來可以解決此問題。

  1. 啓用數據庫郵件存儲的特效:

    sp_configure 'show advanced options', 1; 
    GO 
    RECONFIGURE; 
    GO 
    sp_configure 'Database Mail XPs', 1; 
    GO 
    RECONFIGURE 
    GO 
    
  2. sysmail_add_account_sp創建sysmail帳號:

    EXECUTE msdb.dbo.sysmail_add_account_sp 
    @account_name = 'MailTest', 
    @description = 'Sent Mail using MSDB', 
    @email_address = '[email protected]', 
    @display_name = 'umashankar', 
    @username='[email protected]', 
    @password='password', 
    @mailserver_name = 'mail.queryingsql.com' 
    
  3. sysmail_add_profile_sp創建數據庫配置文件:

    EXECUTE msdb.dbo.sysmail_add_profile_sp 
    @profile_name = 'MailTest', 
    @description = 'Profile used to send mail' 
    
  4. 帳戶的配置文件與sysmail_add_profileaccount_sp地圖:

    EXECUTE msdb.dbo.sysmail_add_profileaccount_sp 
    @profile_name = 'MailTest', 
    @account_name = 'MailTest', 
    @sequence_number = 1 
    
  5. 授予數據庫主體(數據庫用戶或角色)使用的數據庫配置文件:

    EXECUTE msdb.dbo.sysmail_add_principalprofile_sp 
    @profile_name = 'MailTest', 
    @principal_name = 'public', 
    @is_default = 1 ; 
    
    --A principal_name of 'public' makes this profile a public profile, granting access to all principals in the database. 
    
  6. 測試與sp_send_dbmail

    exec msdb.dbo.sp_send_dbmail 
    @profile_name = 'MailTest', 
    @recipients = '[email protected]', 
    @subject = 'Mail Test', 
    @body = 'Mail Sent Successfully', 
    @body_format = 'text' 
    

您還應該查看每個存儲過程的MSDN文檔,以確保正確配置您的系統。

+0

我是一名新秀,所以我現在不能將你的答案標記爲正確。 –

0

我假設你可以使用MSDB中存儲的特效進行設置。我沒有試過這個,但你可能想嘗試一下。

看...

sysmail_add_account_sp 

...和它的相關存儲的特效。

sysmail_add_account_sp MSDN documentation

+0

謝謝你的建議 –

0

默認情況下,SQL Express沒有通過GUI嚮導支持數據庫郵件配置,儘管如此,也可以通過腳本來配置它。

這些detailed instructions指導你。

相關問題