Send Mail

xiaoxiao2021-03-06  19

A summary description of Namespace Tmail {///

/// WebForm1. /// public class Webform1: system.web.ui.page {

MailMessage _MailMessage = new MailMessage (); string UserName = "drk928"; string PassWord = "horse"; string EmailServer = "smtp.163.com"; protected System.Web.UI.WebControls.Button Button1; string EmailTo = "drk928 @ 21cn.com "; Private Void Page_Load (Object Sender, System.EventArgs E) {// Place the user code here to initialize the page} private bool sendvalid () {this._mailmessage.fields [" http: // Schemas. Microsoft.com/cdo/configuration/sendusing "] = 2; if (this.username! = null && this.password! = null) {this._mailmessage.fields [" http://schemas.microsoft.com/cDo/ configuration / smtpauthenticate "] = 1; this._MailMessage.Fields [" http://schemas.microsoft.com/cdo/configuration/sendusername "] = this.UserName; this._MailMessage.Fields [" http: // schemas. microsoft.com/cdo/configuration/sendpassword "] = this.PassWord;} this._MailMessage.To = this.EmailTo; SmtpMail.SmtpServer = this.EmailServer; try {SmtpMail.Send (this._MailMessage);} catch (Exception EX) {//this.writel OGTXT ("ErrorMessage:" EX.MESSAGE, FALSE); Return False;}} #region Web Form Designer generated code override protected void oninit (Eventargs e) {// // codegen: This call is ASP.NET Web Form Designer is required. // InitializeComponent (); base.onit (e);} ///

/// Designer Supports the required method - Do not use the code editor to modify the // / this method. /// private void InitializeComponent () {this.Button1.Click = new System.EventHandler (this.Button1_Click); this.Load = new System.EventHandler (this.Page_Load);} #endregion

转载请注明原文地址:https://www.9cbs.com/read-39524.html

New Post(0)