如何在richtextbox中将图像和文本作为邮件正文发送到Windows窗体中。我现在所做的是,首先我将richtextbox.rtf转换为html并将html数据传递给邮件正文。但是发生的事情是html代码中的图像显示为wmf格式,并且没有显示在接收方。现在该做什么。?
答案 0 :(得分:1)
我有一个解决方案,试试这个。 请在下面找到将其直接发送的Richtexbox值发送到电子邮件正文
的示例public bool Send_Mail(string MessageBody, string Link)
{
try
{
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpace NS = app.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder objFolder = NS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderOutbox);
Microsoft.Office.Interop.Outlook.MailItem objMail = (Microsoft.Office.Interop.Outlook.MailItem)objFolder.Items.Add(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
//objMail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatRichText;
objMail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
objMail.Body = rtxtExtMessage.RichTextBox.Text +"\n\nTo continue discussion click the following link: " + Link;
objMail.Subject = txtSubject.Text;
objMail.To = txtTo.Text;
objMail.CC = txtCc.Text;
objMail.Send();
return true;
}
catch
{
return false;
}
}
如果您需要更多信息,请在下面找到网址 https://social.msdn.microsoft.com/Forums/vstudio/en-US/90f79bfa-76af-4813-9741-08ffa6a36ae9/sending-the-formatted-text-as-an-email-using-c