Private void btnsubmit_click (Object sender, system. eventargs E)
{
// Smtpmail. Send ("shaozhd@263.net", "shaozhd@263.net", "test", "hello"); mailmessage M = new mailmessage ();
M. From = tbfrom. text;
M. To = TBTO. text;
M. Subject = tbsubject. text;
M. Body = tbbody. text;
// Priority
Switch (ddlp. selectedindex)
{
Case 0:
M. Priority = mailpriority. High;
Break;
Case 1:
M. Priority = mailpriority. low;
Break;
Default:
M. Priority = mailpriority. normal;
Break;
}
// Format
If (ddlp. selectedindex = 0)
M. bodyformat = mailformat. text;
Else
M. bodyformat = mailformat. html;
// Set the server as follows
If (tbserver. Text! = "")
{
Smtpmail. smtpserver = tbserver. text;
// The following Code Applicable to framework1.1 and later versions.
M. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ",
"1"); // Basic Authentication
M. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendusername ",
Tbusername. Text); // set your username here
M. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword ",
Tbpass. Text); // set your password here
}
// Process the attachment below
String strfilename = fileselect. postedfile. filename;
If (strfilename! = "")
M. attachments. Add (New mailattachment (strfilename ));
Smtpmail. Send (m );
}
// The socket technology can receive emails