在ASP.NET程序员 用GMail信任票据发送邮件

 

地址如下:

http://www.codeproject.com/KB/aspnet/aspnetemailusinggmail.aspx

 

 

public static void sendMail(string to, string from, string subject,
              string body,string username, string password)
{
    ///Smtp config
    SmtpClient client = new SmtpClient("smtp.gmail.com", 465);
    // Edit password and username
    client.Credentials = new NetworkCredential(""+username+"@gmail.com", password);
    client.EnableSsl = true;

    Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] =
                ""+username+"@gmail.com";
    Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = password;

 

client.Credentials = new NetworkCredential("USERNAME@gmil.com", "PASSWORD");
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] =
            "USERNAME@gmail.com";
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "PASSWORD";

 

作者来自 斯里兰卡(南亚岛国)。

 

 

posted @ 2008-11-11 08:37  信息化建设  阅读(537)  评论(0编辑  收藏  举报