因为要实现outlook和Foxmail 两种客户端的发送邮件功能,所以采用调MAPI
现MAPI发送文本信息已经可以了,但是不知道发送HTML内容需要怎么处理,请教大神。直接传HTML的话会当文本处理
[DllImport("MAPI32.DLL")]
static extern int MAPISendMail(IntPtr sess, IntPtr hwnd, MapiMessage message, int flg, int rsv); int SendMail(string strSubject, string strBody, int how)
{
MapiMessage msg = new MapiMessage();
msg.subject = strSubject;
msg.noteText = strBody;
msg.recips = GetRecipients(out msg.recipCount);
msg.files = GetAttachments(out msg.fileCount); m_lastError = MAPISendMail(new IntPtr(0), new IntPtr(0), msg, how, 0);
if (m_lastError > 1)
MessageBox.Show("MAPISendMail failed! " + GetLastError(), "MAPISendMail"); Cleanup(ref msg);
return m_lastError;
}
现MAPI发送文本信息已经可以了,但是不知道发送HTML内容需要怎么处理,请教大神。直接传HTML的话会当文本处理
[DllImport("MAPI32.DLL")]
static extern int MAPISendMail(IntPtr sess, IntPtr hwnd, MapiMessage message, int flg, int rsv); int SendMail(string strSubject, string strBody, int how)
{
MapiMessage msg = new MapiMessage();
msg.subject = strSubject;
msg.noteText = strBody;
msg.recips = GetRecipients(out msg.recipCount);
msg.files = GetAttachments(out msg.fileCount); m_lastError = MAPISendMail(new IntPtr(0), new IntPtr(0), msg, how, 0);
if (m_lastError > 1)
MessageBox.Show("MAPISendMail failed! " + GetLastError(), "MAPISendMail"); Cleanup(ref msg);
return m_lastError;
}
解决方案 »
- Oledb给参数赋值和连接打开的关系问题
- 关于lookupedit模糊匹配的问题 急!!!
- winform中点击子结点时打开一个网页的问题
- 求助!在WinForm中,怎么调整DataGrid列的宽度?
- 问个VB转换C#问题
- 急问,Label1.Text=Format("%s到%s年度统计",b,c);
- 如何监控进程
- 请教 MessengerAPI 使用问题
- 关于DATASET的使用
- 我做的应用程序用了Process类,但在某些机器上运行时出现"线程计数器禁止使用"错误,何解呢?
- 写个小程序,udp发送大文件,用wireshark捕捉不到数据包,求大神指点
- C#窗体应用程序,导入excel时,报错“未在本地计算机上注册“Microsoft.ACE.OLEDB.12.0”提供程序”
https://msdn.microsoft.com/en-us/library/windows/desktop/dd296720(v=vs.85).aspx骨头就不帮你啃了,办公室没google
你可以搜一下能符合你要的富文本编辑器来满足你的需求