SQL - 配置数据库邮件
SQL - Configure Database Mail
我的数据库邮件没有显示我创建的新配置文件时遇到问题。我正在执行这个:
Execute msdb.dbo.sysmail_add_account_sp
@account_name = 'email here',
@email_address = 'email here' ,
@display_name = 'White Box Gaming' ,
@replyto_address = 'email here' ,
@description = 'Profile used to send mail' ,
@mailserver_name = 'smtp.gmail.com',
@mailserver_type = 'SMTP',
@port = 587,
@username = 'email here',
@password = 'password',
@enable_ssl = 0
没有错误,但是当我尝试查看它时:
select *
from msdb.dbo.sysmail_profile p
join msdb.dbo.sysmail_profileaccount pa on p.profile_id = pa.profile_id
join msdb.dbo.sysmail_account a on pa.account_id = a.account_id
join msdb.dbo.sysmail_server s on a.account_id = s.account_id
没有出现新的配置文件。我错过了什么?
创建邮件帐户后,将其分配给邮件配置文件(查询加入 sysmail_profile 与 sysmail_profile 帐户)
--get profiles
EXEC msdb.dbo.sysmail_help_profile_sp;
--if there is no profile, create one
EXEC msdb.dbo.sysmail_add_profile_sp @profile_name = N'my email profile', @description = N'email profile description';
--get accounts (note down the account_id)
EXEC msdb.dbo.sysmail_help_account_sp;
--get profiles (note down the profile_id)
EXEC msdb.dbo.sysmail_help_profile_sp;
--add account to profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_id= 1/*profile_id goes here*/, @account_id = 1 /*account_id goes here*/, @sequence_number=1;
--list accounts for each profile
EXECUTE msdb.dbo.sysmail_help_profileaccount_sp;
--or
select *
from msdb.dbo.sysmail_profile p
join msdb.dbo.sysmail_profileaccount pa on p.profile_id = pa.profile_id
join msdb.dbo.sysmail_account a on pa.account_id = a.account_id
join msdb.dbo.sysmail_server s on a.account_id = s.account_id;
我的数据库邮件没有显示我创建的新配置文件时遇到问题。我正在执行这个:
Execute msdb.dbo.sysmail_add_account_sp
@account_name = 'email here',
@email_address = 'email here' ,
@display_name = 'White Box Gaming' ,
@replyto_address = 'email here' ,
@description = 'Profile used to send mail' ,
@mailserver_name = 'smtp.gmail.com',
@mailserver_type = 'SMTP',
@port = 587,
@username = 'email here',
@password = 'password',
@enable_ssl = 0
没有错误,但是当我尝试查看它时:
select *
from msdb.dbo.sysmail_profile p
join msdb.dbo.sysmail_profileaccount pa on p.profile_id = pa.profile_id
join msdb.dbo.sysmail_account a on pa.account_id = a.account_id
join msdb.dbo.sysmail_server s on a.account_id = s.account_id
没有出现新的配置文件。我错过了什么?
创建邮件帐户后,将其分配给邮件配置文件(查询加入 sysmail_profile 与 sysmail_profile 帐户)
--get profiles
EXEC msdb.dbo.sysmail_help_profile_sp;
--if there is no profile, create one
EXEC msdb.dbo.sysmail_add_profile_sp @profile_name = N'my email profile', @description = N'email profile description';
--get accounts (note down the account_id)
EXEC msdb.dbo.sysmail_help_account_sp;
--get profiles (note down the profile_id)
EXEC msdb.dbo.sysmail_help_profile_sp;
--add account to profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_id= 1/*profile_id goes here*/, @account_id = 1 /*account_id goes here*/, @sequence_number=1;
--list accounts for each profile
EXECUTE msdb.dbo.sysmail_help_profileaccount_sp;
--or
select *
from msdb.dbo.sysmail_profile p
join msdb.dbo.sysmail_profileaccount pa on p.profile_id = pa.profile_id
join msdb.dbo.sysmail_account a on pa.account_id = a.account_id
join msdb.dbo.sysmail_server s on a.account_id = s.account_id;