日期:2014-05-17 浏览次数:21036 次
string smtpServer = "";
MailMessage message = null;
MailAddress from = new MailAddress("413294344@qq.com");
MailAddress to = new MailAddress("413294344@qq.com");
message = new MailMessage(from, to);
message.Subject = "邮件标题";
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(@"C:\Users\Administrator\Desktop\fin_bg2.png");
message.Attachments.Add(attachment);
message.IsBodyHtml = true;
message.Body += "<img src=\"cid:" + attachment.ContentId + "\"/>";
SmtpClient client = new SmtpClient(smtpServer, 25);
client.Credentials = new System.Net.NetworkCredential("","");
client.Send(message);