Using System;
Using System. Collections. Generic;
Using System. text;
Using System. net. mail;
Namespace Mbacsc. dataaccess
{
Public Class Sendmail
{
/// <Summary>
/// NET 2.0 send email
/// </Summary>
/// <Param name = "strsmtpserver"> Email sending server </Param>
/// <Param name = "strfrom"> Sender email </Param>
/// <Param name = "strfrompass"> Sender Email Password </Param>
/// <Param name = "strto"> Recipient email </Param>
/// <Param name = "strsubject"> Email Subject </Param>
/// <Param name = "strbody"> Email content </Param>
Public Static Void Send ( String Strsmtpserver, String Strfrom, String Strfrompass, String Strto, String Strsubject, String Strbody)
{
Smtpclient Client = New Smtpclient (strsmtpserver );
client. usedefacrecredentials = false ;< br> client. credentials = New system. net. networkcredential (strfrom, strfrompass);
client. deliverymethod = smtpdeliverymethod. network;
Byte [] B=Encoding. Default. getbytes (strbody );
Strbody=Encoding. getencoding ("Gb2312"). Getstring (B). tostring ();
Mailmessage message= NewMailmessage (strfrom, strto, strsubject, strbody );
Message. bodyencoding=Encoding. utf8;
Message. isbodyhtml= True;
Client. Send (Message );
}
}
}