我想通过发送表格电子邮件格式的截图自动化我的工作
. 我已成功附加为文件,但我希望它在表格格式。这是我已经尝试过的代码
public static void email_send() {
string htmlBody = "<html><body><h1>Picture</h1><br><img src=\"cid:test1.jpeg\"></body></html>";
AlternateView avHtml = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
LinkedResource inline = new LinkedResource("test1.jpeg", MediaTypeNames.Image.Jpeg);
inline.ContentId = Guid.NewGuid().ToString();
avHtml.LinkedResources.Add(inline);
Attachment att = new Attachment(@"D:/test123.png");
att.ContentDisposition.Inline = true;
MailMessage mail = new MailMessage();
mail.AlternateViews.Add(avHtml);
System.Net.Mail.SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("*****");
mail.To.Add("*******");
mail.Subject = "Test Mail - 1";
mail.Body = String.Format(
"<h3>Client: " + " Has Sent You A Screenshot</h3>" +
@"<img src=""cid:{0}"" />", inline.ContentId);
mail.IsBodyHtml = true;
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("******", "******");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}