Public static bool send (string sendto, string subject, string body)
{
Return send (sendto, subject, body, false );
}
Public static bool send (string sendto, string subject, string body, bool ishtml)
{
Bool result = false;
Iphostentry IPE = DNS. gethostentry (DNS. gethostname ());
IPaddress IPA = IPE. Addresslist [0];
// The local SMTP Server
Smtpclient client = new smtpclient (IPA. tostring ());
String Password = configurationmanager. receivettings [IPA. tostring ()];
Client. Credentials = new networkcredential ("Administrator", password );
//
// Smtpclient client = new smtpclient ("smtp.163.com"); // Mail Server
// Client. Credentials = new networkcredential ("cccdddppp@163.com", "password ");
Mailmessage MSG = new mailmessage ("Manage@Tjy.net", sendto );
MSG. subjectencoding = msg. bodyencoding = encoding. getencoding ("gb2312 ");
MSG. isbodyhtml = ishtml;
MSG. Subject = subject;
MSG. Body = body;
// Mailaddress from = new mailaddress ("service@carhappy.com.cn ");
// Mailaddresscollection to = new mailaddresscollection ();
Try
{
Client. Send (MSG );
Result = true;
}
Catch (exception)
{
Result = false;
}
Return result;
}