Public Static voidQqfs () {Try{mailmessage mm=NewMailMessage (); MailAddress Fromma=NewMailAddress ("[email protected]"); MailAddress Toma=NewMailAddress ("[email protected]",NULL); Mm. from=Fromma; //RecipientMm. To.add ("[email protected]"); //Mailbox HeaderMm. Subject ="Hello Dear:"; Mm. Isbodyhtml=true; //Message ContentMm. Body ="Hello Mr Meteor! "; //encoding format for contentMm. Bodyencoding =System.Text.Encoding.UTF8; //mm. ReplyTo = Toma; //mm. Sender =fromma; //mm. isbodyhtml = false;Mm. Deliverynotificationoptions =deliverynotificationoptions.onsuccess; Mm. Cc. ADD (Toma); SmtpClient SC=NewSmtpClient (); NetworkCredential NC=NewNetworkCredential (); nc. UserName="[email protected]";//your e-mail addressnc. Password ="xxxxxxxx";//email password, the password is [email protected] Email password ~Sc. useDefaultCredentials =true; Sc. Deliverymethod=smtpdeliverymethod.network; Sc. Credentials=NC; //If this is reported to mail from address must is same as authorization user this error, is your QQ mailbox does not open SMTP,//go to your own mailbox to set it up! Under the account, if is 163 mailbox, below should become smtp.163.comSc. Host ="smtp.qq.com"; Sc. Send (mm); } Catch(Exception ex) {Throw NewException (ex. Message); } }
C #. NET Call QQ mailbox