// SMTP server
String SMTPSERVER = "SMTP.sohu.com"; // This can also be another SMTP server, then modify the corresponding username and password
// SMTP corresponds to the mailbox user name
String SMTPUSERNAME = "Your Mail User Name";
// SMTP corresponds to mailbox password
String SMTPASSWORD = "Your mail user password";
MailMessage Mail = New MailMessage ();
// Accept the email address
Mail.to = mailto.text;
// Send the email address
Mail.from = mailfrom.text;
//Email Subject
Mail.subject = mailsubject.text;
// mail format
Mail.BodyFormat = mailformat.text;
//content of email
Mail.body = mailcontent.text;
// mail code
Mail.BodyEncoding = system.text.Encoding.getencoding ("GB2312");
Mail.fields.add ("
Http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1 ");
Mail.fields.add ("
Http://schemas.microsoft.com/cdo/configuration/sendusername" ,smtpusername);
Mail.fields.add ("
Http://schemas.microsoft.com/cdo/configuration/sendpassword" ,smtppassword);
SMTPMAIL.SMTPSERVER = SMTPSERVER;
//send email
SMTPMAIL.SEND (MAIL);
Label5.text = "Send success!";