View code
1 System. net. Mail. smtpclient Client = New System. net. Mail. smtpclient ();
2 Client. Host = " Smtp.qq.com " ;
3 Client. usedefacrecredentials = False ;
4 Client. Credentials = New System. net. networkcredential ( " Email user name " , " Email Password " );
5 Client. deliverymethod = System. net. Mail. smtpdeliverymethod. Network;
6 System. net. Mail. mailmessage message = New System. net. Mail. mailmessage ( " Sender's email address " , " Recipient's email address " );
7 Message. Subject = " Penalty Decision on xx " ;
8 Message. Body = " <Center> penalty decision on XX </center> <br/> penalty decision on XX: Penalty Decision on xx " ;
9 Message. bodyencoding = Encoding. utf8;
10 Message. isbodyhtml = True ;
11 System. net. Mail. Attachment m; // Attachment
12 If ( This . Fileupload1.hasfile)
13 {
14 M = New System. net. Mail. Attachment ( This . Fileupload1.postedfile. filename );
15 Message. attachments. Add (m );
16 }
17 Client. Send (Message );