Sql server 在SQL server 2012中使用exchange server配置数据库邮件
如果我们可以使用Exchange Server在SQL Server 2012中设置邮件配置文件,是否有人可以告诉我Sql server 在SQL server 2012中使用exchange server配置数据库邮件,sql-server,sql-server-2012,exchange-server,Sql Server,Sql Server 2012,Exchange Server,如果我们可以使用Exchange Server在SQL Server 2012中设置邮件配置文件,是否有人可以告诉我 除了使用SMTP,我在服务器中找不到任何选项。SQL server数据库邮件仅支持SMTP。但是,Exchange通常配置为充当SMTP服务器。请与exchange管理员联系,提供设置数据库邮件配置文件所需的主机名和帐户信息 下面是获得此信息后配置数据库邮件的示例 -- Enable Database Mail for this instance EXECUTE sp_conf
除了使用SMTP,我在服务器中找不到任何选项。SQL server数据库邮件仅支持SMTP。但是,Exchange通常配置为充当SMTP服务器。请与exchange管理员联系,提供设置数据库邮件配置文件所需的主机名和帐户信息 下面是获得此信息后配置数据库邮件的示例
-- Enable Database Mail for this instance
EXECUTE sp_configure 'show advanced', 1;
RECONFIGURE;
EXECUTE sp_configure 'Database Mail XPs',1;
RECONFIGURE;
GO
-- Create a Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'Primary Account',
@description = 'Account used by all mail profiles.',
@email_address = 'myaddress@mydomain.com',
@replyto_address = 'myaddress@mydomain.com',
@display_name = 'Database Mail',
@mailserver_name = 'mail.mydomain.com';
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'Default Public Profile',
@description = 'Default public profile for all users';
-- Add the account to the profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'Default Public Profile',
@account_name = 'Primary Account',
@sequence_number = 1;
-- Grant access to the profile to all msdb database users
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'Default Public Profile',
@principal_name = 'public',
@is_default = 1;
GO
--send a test email
EXECUTE msdb.dbo.sp_send_dbmail
@subject = 'Test Database Mail Message',
@recipients = 'testaddress@mydomain.com',
@query = 'SELECT @@SERVERNAME';
GO