惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - xumingming

C# 长浏览 SQL Server 的位运算 sql 的随机函数newID()和RAND() Linq To Xml (增,删,改,查) - xumingming sp_executesql的用法 Sql Server 存储过程分页 linq 存储过程返回多个结果集 一些常用的类 MVC Controller与ActionResult的返回值 - xumingming - 博客园 IEnumerable_T_、IEnumerable、ICollection_T_、IList_T_、ObservableCollectin_T_和Collection_T_得关系 routes.MapRoute - xumingming - 博客园 JQuery与Ajax常用代码 MVC 小笔记 - xumingming - 博客园 GridView 的临时增删改查示例 GridView 72般绝技 C#代码中的事务 - xumingming - 博客园 VS2005中将GridView 中的数据导出至excel - xumingming 触发器 删除数据库表中的信息(适用于被注入)
Sql语句访问WEB
xumingming · 2010-03-05 · via 博客园 - xumingming

代码

CREATE PROC callSendMailPAGE
@url VARCHAR(1000)
AS
BEGIN
DECLARE @xmlHttp INT,@error INT
EXEC @error = sp_OACreate "Microsoft.XMLHTTP",@xmlHttp OUTPUT
EXEC @error = sp_OAMethod @xmlHttp,'Open',NULL,'POST',@url,'True'
EXEC @error = sp_OAMethod @xmlHttp,'Send',NULL,NULL
EXEC @error = sp_OAMethod @xmlHttp,'Close',NULL
EXEC @error = sp_OADestroy @xmlHttp
END

JOB里执行 EXEC callSendMailPAGE 'http://www.yourdomain.com/mysendmail.aspx'

这种做法,实际上是, 用sqlagent服务充当了你的winform+timer或自定义的windows service.  通过sp_oa系列存储过程调用xmlhttp访问你的mysendmail.aspx来实现发送邮件.当然,你可以在页面加上对应的参数,只有参数正确才触发发送邮件方法.这样,当某人无意访问了你这个地址时,页面也不会发送邮件.只通过这个存储过程来执行.

这也算是懒人做法,如果是我,我有可能也是这么弄,懒得写windows service.

要么就不用mysendmail.aspx这个东西.全部在数据库端实现,即 sp_oa系列过程来调用jmail或cds. 或者直接用sqlmail处理.