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

推荐订阅源

Engineering at Meta
Engineering at Meta
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
IT之家
IT之家
F
Full Disclosure
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
B
Blog
H
Help Net Security
The Cloudflare Blog
Recorded Future
Recorded Future
P
Proofpoint News Feed
P
Proofpoint News Feed
C
Cisco Blogs
T
Tailwind CSS Blog
P
Palo Alto Networks Blog
D
Docker
爱范儿
爱范儿
Know Your Adversary
Know Your Adversary
博客园 - 聂微东
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Y
Y Combinator Blog
雷峰网
雷峰网
AWS News Blog
AWS News Blog
D
DataBreaches.Net
博客园 - 司徒正美
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
Blog — PlanetScale
Blog — PlanetScale
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
阮一峰的网络日志
阮一峰的网络日志
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
小众软件
小众软件
G
Google Developers Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
O
OpenAI News

博客园 - 绿叶

Suspicions about the new platform dynamic sorting expression builder How to create your own api with ACL in Magento 台服信长之野望全后台辅助外挂 SEO Elite ver 4.0 R93 Patcher Remove 5 seconds constraint in Garena(GGC) - 绿叶 Robot development framework in Mush Client (Lua) 巧用Marshal.GetDelegateForFunctionPointer--C#如何调用按键精灵插件dll Using .Net, Flex, and Red5 to create a flash web application 做了个C#的Hotkey简单封装,希望对大家有帮助 功夫世界外挂发布测试 我的第一个全后台CALL外挂-功夫世界外挂 通过修改Mutex来达到大航海OL多开 如何利用WPE对大航海Online进行港内瞬移,瞬时生产和快速进港 MonoRail PetShop Source Code Released MS PetShop3 -> MonoRail PetShop 完成移植 移植MSPetShop3到Castle MonoRail -Model与DAL层的移植(AR) 对 "闭包-closure" 的一些见解 圈内Castle文章索引
利用Castle Framework发email是如此easy
绿叶 · 2006-03-08 · via 博客园 - 绿叶

        最近要在项目中发送对用户发送各种各样的邀请函,项目是使用castle作为框架的。发现castle中的一个Component(email sender)是封装了System.Web.Mail,而framework再对这个Component封装,从而使他email支持模板,废话少说,看具体用法吧:

配置:
        1.在web.config中的配置smtp的几个简单参数:

<monoRail smtpHost="host name" smtpUsername="username" smtpPassword="password">
.
</monoRail>

        2.在views目录下建个mail目录,放email模板,比如:(invitation.vm)

from:$from
to:$to
subject:$subject
<html>
<head>
<title>邀请函</title>
</head>
<body>
$name 邀请你XXXXX
</body>
</html>

        3.先用PropertyBag.Add模板的的参数,比如:PropertyBag.Add("from", "wjshome#gmail.com")

        4.使用RenderMailMessage("invitation")函数获取一个Message对象
这里你可以更改他的encording,中文可以设置成"gb2312"。
还可以更改message的format,做format时,框架已经自动帮你处理了,如果检测到模板中包含<html>,则自动把format设置成html格式。

        5.用DeliverEmail(message)发送。

        6.如果你不用设置Message对象的参数的话,你可以直接用RenderEmailAndSend("invitaion")替代第4.5步。

呵呵~完了,简单吧,有兴趣的去试试~~