Welcome to Rolland Town which Record fire's life.
« »
2004年01月17日03年9月-06年9月存档

109 views

.NET发送邮件

  长期以来,所有的网络脚本都是使用免费的邮件服务器发送邮件,或者是自己的(我了解到的如此,恕我孤陋寡闻)。.NET 1.1已经提供了这个功能。刚才在开心的blog上看到——如何通过需要验证的邮件服务器发送邮件?真的不错。

  在此,想到大鱼用.Text构架的这个blog,现在的邮件功能还不能使用。希望大鱼看看,改进改进,呵呵。另外这个代码也可以供平常使用,一举两得。贴出代码,以免我忘记了。

private void Page_Load(object sender, System.EventArgs e)
{
       MailMessage mail = new MailMessage();
       mail.To = “me@mycompany.com”;
       mail.From = “you@yourcompany.com”;
       mail.Subject = “this is a test email.”;
       mail.Body = “Some text goes here”;
       mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”, “1″); //basic authentication
       mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusername”, “my_username_here”); //set your username here
      mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendpassword”, “super_secret”); //set your password here

    SmtpMail.SmtpServer = “mail.mycompany.com”;  //your real server goes here
    SmtpMail.Send( mail );
}

参考资料:

http://vaultpub.sourcegear.com/VaultService/VaultWeb/Blame.aspx?repid=7&path=$/Dottext/Dottext.Framework/Email/SystemMail.cs&version=1&includedversions=20 (用户名及密码为guest)

http://www.systemwebmail.com/faq/3.8.aspx

版权声明 »

可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明
本文url:http://netfire.name/archives/20040117/87.html

日志信息 »

该日志于2004-01-17 00:17由 NetFire 发表在03年9月-06年9月存档分类下, 评论已关闭。

AdSense »

没有评论

抱歉,评论被关闭

返回顶部