关于用CDO发邮件的程序(不要看那么多代码,其实很简单)。 有的SMTP服务器不支持直接使用SMTP连接,查查看 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 汗,我换成163.com也不行啊,而且错误提示是不能连接到服务器啊。。但我的outlook express都正常的,是 163.net 我就不相信,这么个小问题能难倒广大csdn的高手?再顶 为什么要用CDO.Configuration配置呢?你如果仅仅是发邮件的话,可以把Configuration conf=new ConfigurationClass(); conf.Fields[CdoConfiguration.cdoSendUsingMethod].Value=CdoSendUsing.cdoSendUsingPort; conf.Fields[CdoConfiguration.cdoSMTPServer].Value="smtp.tom.com"; conf.Fields[CdoConfiguration.cdoSMTPServerPort].Value=25; conf.Fields[CdoConfiguration.cdoSMTPAccountName].Value="gabriel_yw"; conf.Fields[CdoConfiguration.cdoSendUserReplyEmailAddress].Value="\"hydnoahark\" <[email protected]>"; conf.Fields[CdoConfiguration.cdoSendEmailAddress].Value="\"hydnoahark\" <[email protected]>"; conf.Fields[CdoConfiguration.cdoSMTPAuthenticate].Value=CdoProtocolsAuthentication.cdoBasic; conf.Fields[CdoConfiguration.cdoSendUserName].Value="gabriel"; conf.Fields[CdoConfiguration.cdoSendPassword].Value="mypassword"; conf.Fields.Update();这部分全部删掉,没有任何影响。 楼上,可是smtp服务器是要身份验证的啊,该怎么办?如果那样,我干脆用.net自带的SmtpMail类了 现在发邮件必须用ESMTP协议,现在的服务器也只支持ESMTP协议(就是带密码验证的那种).NET不支持ESMTP,也就是你直接用.NET提供的类都发不了邮件,包括MailMessage类。你必须自己写发邮件的代码(跟据ESMTP协议)你如果需要的话我有一个VB的例子(支持ESMTP)QQ:67690945 System.Web.Mail.SmtpMail; System.Web.Mail.MailAttachmentl;MailMessage myMail=new MailMessage();myMail.From=from.Text;myMail.To="[email protected]";myMail.Subject=subject.Text;myMail.Body=body.Text;myMail.BodyFormat=MailFormat.HtmlSmtipMail.Send(myMail);Message.InnerHtml="";myMail.Attachments.Add(new MailAttachment("c:\\readme.txt")); WPF应用程序运行后在任务栏中显示的图标问题 我是新手,怎么判断button是否被点击 关于MAIL开发的几个问题,望大家给我推荐几本参考书 求助贴,请给我推荐二三本C#编程技术或思想的书~ 一个c#编程的小问题 怎么关掉登陆界面 c#.net2003与2005的区别 有经验的朋友进来看下 关于数组在子窗体中显示的问题 c#做注册时,年龄下拉框的赋值以及如何添加到数据库 当网络传输中出现多少个零BYTE 接受端会认为传输结束? 怎样判断输入的是数字还是字符??? 请教大虾,怎样在后台运行一段程序,具体情况请看正文
再顶
你如果仅仅是发邮件的话,可以把
Configuration conf=new ConfigurationClass();
conf.Fields[CdoConfiguration.cdoSendUsingMethod].Value=CdoSendUsing.cdoSendUsingPort;
conf.Fields[CdoConfiguration.cdoSMTPServer].Value="smtp.tom.com";
conf.Fields[CdoConfiguration.cdoSMTPServerPort].Value=25;
conf.Fields[CdoConfiguration.cdoSMTPAccountName].Value="gabriel_yw";
conf.Fields[CdoConfiguration.cdoSendUserReplyEmailAddress].Value="\"hydnoahark\" <[email protected]>";
conf.Fields[CdoConfiguration.cdoSendEmailAddress].Value="\"hydnoahark\" <[email protected]>";
conf.Fields[CdoConfiguration.cdoSMTPAuthenticate].Value=CdoProtocolsAuthentication.cdoBasic;
conf.Fields[CdoConfiguration.cdoSendUserName].Value="gabriel";
conf.Fields[CdoConfiguration.cdoSendPassword].Value="mypassword";
conf.Fields.Update();
这部分全部删掉,没有任何影响。
如果那样,我干脆用.net自带的SmtpMail类了
System.Web.Mail.MailAttachmentl;
MailMessage myMail=new MailMessage();
myMail.From=from.Text;
myMail.To="[email protected]";
myMail.Subject=subject.Text;
myMail.Body=body.Text;
myMail.BodyFormat=MailFormat.Html
SmtipMail.Send(myMail);
Message.InnerHtml="";
myMail.Attachments.Add(new MailAttachment("c:\\readme.txt"));