Static void Sendmail ()
{
VaR M = new mailmessage ();
M. From = new mailaddress ("youjb@xxx.com.cn ");
M. to. Add (New mailaddress ("youjb@xxx.com.cn "));
M. attachments. Add (new attachment (@ "C:/users/greystar/desktop/Jiangyin/img_1463.jpg "));
M. attachments [0]. contentid = "mypic ";
M. attachments [0]. contentdisposition. inline = true;
M. attachments [0]. nameencoding = M. subjectencoding = M. bodyencoding = encoding. utf8;
M. Subject = "test email ";
M. isbodyhtml = true;
M. body = string. format (@ " <a href =" "{0}" "tartget =" "_ bland" "> click open an image in the window </a> ", "CID:" + M. attachments [0]. contentid );
VaR S = new smtpclient ();
S. Port = 25;
S. Host = "mail.xxx.com.cn ";
S. Credentials = new system. net. networkcredential ("youjb@xxx.com.cn", "mypwd ");
Try
{
S. Send (m );
}
Catch (exception ex)
{
Console. writeline (ex. Message );
}
}