从sql server 2005发送电子邮件 [英] send email from sql server 2005

查看:78
本文介绍了从sql server 2005发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从sql server发送电子邮件...

我m

i want to send email from sql server ...

i m

use master
go
sp_configure 'show advanced options',1
go
reconfigure with override
go
sp_configure 'Database Mail XPs',1
--go
--sp_configure 'SQL Mail XPs',0
go
reconfigure
go


EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'MyMailAccount2',
@description = 'Mail account for Database Mail',
@email_address = 'dilip.aim12@gmail.com',
@display_name = 'MyAccount',
@username='dilip.aim12@gmail.com',
@password='*********',
@mailserver_name = 'smtp.gmail.com'


EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'MyMailProfile2',
@description = 'Profile used for database mail'

EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'MyMailProfile2',
@account_name = 'MyMailAccount2',
@sequence_number = 1

EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'MyMailProfile2',
@principal_name = 'public',
@is_default = 1

declare @body1 varchar(100)
set @body1 = 'Server :'+@@servername+ ' My First Database Email '
EXEC msdb.dbo.sp_send_dbmail @recipients='dilip.aim11@gmail.com',
@subject = 'My Mail Test',
@body = @body1,
@body_format = 'HTML' ;





消息即将到来





message is coming

Mail queued.




但我无法收到邮件...
提供任何解决方案...




but i not able to received the mail...
give any solution...

推荐答案

http ://www.kodyaz.com/articles/sql2005-database-mail.aspx [ ^ ]
http://www.howtogeek.com /howto/database/sending-automated-job-email-notifications-in-sql-server-with-smtp/ [
http://www.kodyaz.com/articles/sql2005-database-mail.aspx[^]
http://www.howtogeek.com/howto/database/sending-automated-job-email-notifications-in-sql-server-with-smtp/[^]

Check if antivirus is blocking the automated emails.


这篇关于从sql server 2005发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆