使用IMAP设置配置邮件时,无法获取Outlook 2010的邮件正文 [英] Failed to get mail body of outlook 2010 when mail is configured with IMAP setting

查看:179
本文介绍了使用IMAP设置配置邮件时,无法获取Outlook 2010的邮件正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,





我为outlook编写了加载项代码。我使用IMAP设置在outlook中配置了我的电子邮件。每当发生新邮件事件时,我都无法获取邮件正文(HTML / Plain)文本。它也在Put_mail()函数中创建了一个问题。请指导我解决问题





谢谢先进。

Hello,


I wrote add-in code for outlook. I configured my email in outlook with IMAP setting. Whenever new mail event occured I am unable to get mail body (HTML/Plain)text. It creating a problem in Put_mail() function as well. Please guide me to resolve problem


Thanks In advanced.

推荐答案

你好理查德,



这是我的代码。当我的Outlook电子邮件配置了IMAP设置时。 (imap.gmail.com和stmp.gmail.com)。那时,bstrBody获取NULL检索。但是(HRESULT)hr值为S_OK。所以我没有得到问题出现的地方。 put_mail()函数也是如此。



void CAdIn :: OnNewItemSEH(IDispatch * item)

{

Hello Richard,

This is my code. When my outlook email is configured with IMAP setting. (imap.gmail.com and stmp.gmail.com ). At that time ,bstrBody get retrieve with NULL. But (HRESULT)hr value as S_OK. So I am not getting where the problem arise. Same thing happened for put_mail() function.

void CAdIn::OnNewItemSEH(IDispatch * item)
{
CComQIPtr<Outlook::_MailItem> spNewMailitem(item);

 if (!spNewMailitem)
 {
       return;      
 }
           
		BSTR bstrBody ;

		OlBodyFormat bodyFormat;
		pMail->get_BodyFormat(&bodyFormat);


		if (bodyFormat == olFormatHTML)
		{
			hr = pMail->get_HTMLBody(&bstrBody);
		}
		else
		{
			hr = pMail->get_Body(&bstrBody);
		}

		if (SUCCEEDED(hr))
		{
			return CString(bstrBody);
		}
		else
		{
			_com_error err(hr);
		}


这篇关于使用IMAP设置配置邮件时,无法获取Outlook 2010的邮件正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆