用 MailMessage 发邮件(System.Web.Mail,针对.NET 1.1而说),举例代码如下:MailMessage mailMsg = new MailMessage();
mailMsg.To = "[email protected]";
mailMsg.From = "[email protected]";
mailMsg.Subject = "邮件主题";
mailMsg.Body = "邮件内容";
mailMsg.BodyFormat = MailFormat.Html;
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "SendUserName");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "SendPassword");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", SmtpServerPort);
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1");
SmtpMail.SmtpServer = "SmtpSendServer";
SmtpMail.Send(mailMsg);我的问题是:1、mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", SmtpServerPort) 中,SmtpServerPort 的数据类型标准的应该是什么?我试过整型和字符串型都可以。2、mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 中,其值除了 "1" 是否还有 "0" ,此外是否还可以用 true/false 表示?标准的应该是什么?如果需要验证的话我试过 1/"1"/true 都可以。对于 mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1") 亦是同样的问题。3、"http://schemas.microsoft.com/cdo/configuration/sendusername" 等键值为什么是一个 URL?其真正的意义是什么?为什么不可以直接用 "sendusername" 等来表示?除了上面列举的之外,还有哪些?希望高人可以给予解答一下,十分感谢!
mailMsg.To = "[email protected]";
mailMsg.From = "[email protected]";
mailMsg.Subject = "邮件主题";
mailMsg.Body = "邮件内容";
mailMsg.BodyFormat = MailFormat.Html;
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "SendUserName");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "SendPassword");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", SmtpServerPort);
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1");
SmtpMail.SmtpServer = "SmtpSendServer";
SmtpMail.Send(mailMsg);我的问题是:1、mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", SmtpServerPort) 中,SmtpServerPort 的数据类型标准的应该是什么?我试过整型和字符串型都可以。2、mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 中,其值除了 "1" 是否还有 "0" ,此外是否还可以用 true/false 表示?标准的应该是什么?如果需要验证的话我试过 1/"1"/true 都可以。对于 mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1") 亦是同样的问题。3、"http://schemas.microsoft.com/cdo/configuration/sendusername" 等键值为什么是一个 URL?其真正的意义是什么?为什么不可以直接用 "sendusername" 等来表示?除了上面列举的之外,还有哪些?希望高人可以给予解答一下,十分感谢!
解决方案 »
- google map js问题谢谢
- 有些浏览器客户端的程序没有更新,是怎么回事情?
- ★ ★ ★ ★ 小白请教:学习PetShop4.0,关于连接字符串?★ ★ ★ ★
- 怎样在gridview的编辑模板中应用像google搜索栏那样的文本框?
- 微软的<微软快速成长型企业中心 在线点播中心>菜单太帅了,进来看研究一下。
- 求一高难度SQL语句.到现在无人能解决.
- 在线急等:ASP.NET里文本框让用户输入的时候,怎么可以防止用户输入<font></font>或<脚本></脚本>一类的东东
- table控件里包含的button控件访问当前行(tablerow)的问题
- 急!!!放弃使用Ajax后页面间调用如何获取返回值
- wpf Gecko 如何与javascript交互 在线急等
- asp.net
- 显示信息框后,页面格式为什么会改变?
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", ConfigHelper.SmtpAuthenticate); //值为 true/false、1/0、"1"/"0" 均可
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1"); //值为 true/false、1/0、"1"/"0" 均可