FastDev是我这一年来, 在开发中总结积累而写的一些方便开发的组件.主要是用于ASP.NET开发.像邮件发送组件,静态页组件,数据验证组件等等.
今天先介绍一下这个邮件发送组件.
先说使用啊,首先是配置文件, FastDev.config, 放置于根目录下.

<?xml version="1.0"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="FastDev.xsd">

    
<configSections>
        
<sectionGroup name="FastDev">
            
<section name="Mail" type="FastDev.Mail.MailConfig, FastDev.Mail" allowDefinition="Everywhere" allowLocation="true"/>
        
</sectionGroup>
    
</configSections>
    
    
<FastDev>
        
<Mail>
            
<Configs>
                
<add Name="163" FromAddress="xiaosonl@163.com" UserName="xiaosonl" Password="XXX"/>
                
<!--EnableSsl是否使用SSL加密,例如GMail就使用SSL.-->
                
<add Name="gmail" FromAddress="xiaosonl@gmail.com" UserName="xiaosonl@gmail.com" Password="XXX" EnableSsl="true" Port="587"/>
            
</Configs>
        
</Mail>
    
</FastDev>

</configuration>


每个<add />节点对应一个MailClient类的配置, 使用MailClientManager.GetMailClient方法获取指定的MailClient, 接受名称或顺序参数:

FastDev介绍系列之[邮件发送组件]public static MailClient GetMailClient(string name)
FastDev介绍系列之[邮件发送组件]
FastDev介绍系列之[邮件发送组件]
public static MailClient GetMailClient(int index)


然后是发邮件方法:

 isAsync)


调用MailClient.SendMail方法发送就可以了.

源代码及示例下载: FastDev.Mail.rar

相关文章:

  • 2022-12-23
  • 2021-12-29
  • 2021-12-29
  • 2022-02-09
  • 2021-06-07
  • 2021-11-30
  • 2021-10-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-11-14
  • 2021-10-19
  • 2022-03-08
  • 2021-05-19
相关资源
相似解决方案