Exchange Server学习---发送邮件

Introduction to Collaboration Data Objects for Microsoft Exchange 2000

 

  介绍了CDO的一些知识,并介绍了如何使用CDO协同Exchange Server进行工作。
     
   
  文章中提供了几个使用CDO进行工作的示例,不过全部都是asp时代的代码,看着费劲,还是转换成c#巴:)

   1 发送邮件
'vb
'Create variable
Dim objAddressee

'Point it to a CDO addressee object
Set objAddressee = CreateObject("CDO.Addressee")
'Set the address to send to
objAddressee.emailaddress = "someone@microsoft.com"
'Declare the message variable, Msg
Dim Msg

'Since this is VBScript, you must use the CreateObject method.
Set Msg = CreateObject("CDO.Message")
With Msg
   .To   = "someone@microsoft.com"
   .From = "userX@microsoft.com"
   .Subject  = "Lunch meeting"
   .TextBody = "I have attached the suggested menu."
   .AddAttachment "file://c:/menu.doc"
   .Send
End With


//c#
//例子中的Set objAddressee = CreateObject("CDO.Addressee")在以后的代码中并没有出现,于是x掉
CDO.Message msg=new CDO.MessageClass();

   msg.To="some@some";
   msg.From="some@some";
   msg.Subject="this is11111 subject";
   msg.TextBody="this is test body";
  
   msg.AddAttachment("c:\\1.txt","username","password");//好像用户名&密码填错了没有关系

   msg.Send();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值