MailMessage mail = new MailMessage();
        mail.Subject = “XX is going down”;
        mail.Body = “Pls check asap”;
        mail.From = “”;
        mail.To = “;”; //semicolon-delimited receiver list
        mail.Fields.Add(“”, 2); //use 2 to send using SMTP over the network
        mail.Fields.Add(“”, 1); //use basic authentication
        mail.Fields.Add(“”, “username”)
        mail.Fields.Add(“”, “password”)

                SmtpMail.SmtpServer = “YourServer”;
        catch (WebException ex)
        { … }

smtpserver: SMTP server name.
smtpserverport: SMTP server port (default: 25).
sendusing: cdoSendUsingPort, value 2, for sending the message using the network.
smtpauthenticate: Specifies the mechanism used when authenticating to an SMTP service over the network. Possible values are:
        – cdoAnonymous, value 0. Do not authenticate.
        – cdoBasic, value 1. Use basic clear-text authentication. When using this option you have to provide the user name and password through the sendusername and sendpassword fields.
        – cdoNTLM, value 2. The current process security context is used to authenticate with the service.
sendusername: Username
sendpassword: Password


mail.Fields.Add(“”, 2); //use current system context


This entry was written by Longzhang Fu , posted on Thursday February 04 2010at 11:02 am , filed under .Net Framework and tagged , , . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

One Response to “System.Web.Mail中的验证问题”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>