手机
当前位置:查字典教程网 >编程开发 >C#教程 >C#使用CDO发送邮件的方法
C#使用CDO发送邮件的方法
摘要:本文实例讲述了C#使用CDO发送邮件的方法。分享给大家供大家参考。具体分析如下:CDO是一个名为MicrosoftCDOForExchang...

本文实例讲述了C#使用CDO发送邮件的方法。分享给大家供大家参考。具体分析如下:

CDO是一个名为Microsoft CDO For Exchange 2000 Library的COM组件,我们可以用它来连接SMTP Server,使用用户名/密码验证发送邮件。

/** * C# Programmers Pocket Consultant * Author: Gregory S. MacBeth * Email: gmacbeth@comporium.net * Create Date: June 27, 2003 * Last Modified Date: * Version: 1 */ using System; using CDO; using ADODB; namespace Client.Chapter_19___Office_Integration { public class UsingCDOEx { static void Main(string[] args) { Message MyMessage = new MessageClass(); Configuration MyConfig = MyMessage.Configuration; Fields MyFields = MyConfig.Fields; MyFields[@"http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2; MyFields[@"http://schemas.microsoft.com/cdo/configuration/smtpserverport"].Value = 25; MyFields[@"http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = "smarthost"; MyFields.Update(); MyMessage.Configuration = MyConfig; MyMessage.TextBody = "This is a test message"; MyMessage.Subject = "Testing"; MyMessage.From = "gregmcb@microsoft.com"; MyMessage.To = "pmacbeth@comporium.com"; MyMessage.Send(); } } }

希望本文所述对大家的C#程序设计有所帮助。

【C#使用CDO发送邮件的方法】相关文章:

C#操作目录与文件的方法步骤

C#中使用split分割字符串的几种方法小结

C#中Web.Config加密与解密的方法

使用checked语句防止数据溢出的解决方法

C# 抓取网页内容的方法

C#中使用IrisSkin2.dll美化WinForm程序界面的方法

VB.NET中Caching的使用方法

解决C#全屏幕截图的实现方法

C#技巧之快速删除bin和obj文件夹的方法

C#注释的一些使用方法浅谈

精品推荐
分类导航