[英]Unable to retrieve email content with Poco library
As I was trying to build an email client with Poco library.当我尝试使用 Poco 库构建电子邮件客户端时。 I found out that I can't retrieve content with the following method.我发现我无法使用以下方法检索内容。
for ( auto i = messages.begin(); i != messages.begin()+10; ++i )
{
MessageHeader header;
session.retrieveHeader((*i).id, header);
std::cout << "Subject:" << header.get("Subject");
std::cout << "Content" << header.get("Content");
/// Can't perform the above because there are no "Content:" in the
/// RFC2822.
}
///example in the RFC 2882
----
From : John Doe <jdoe@machine(comment). example>
To : Mary Smith
__
<mary@example.net>
Subject : Saying Hello
Date : Fri, 21 Nov 1997 09(comment): 55 : 06 -0600
Message-ID : <1234 @ local(blah) .machine .example>
This is a message just to say hello.
So, "Hello".
----
And also the "Poco/Net/NameValueCollection" which is the parent class of MessageHeader does not provide a method to retrieve the email content.而且作为 MessageHeader 的父类的“Poco/Net/NameValueCollection”不提供检索电子邮件内容的方法。
const std::string& NameValueCollection::get(const std::string& name)
{
ConstIterator it = _map.find(name);
if (it != _map.end())
return it->second;
else
throw NotFoundException(name);
}
So, my question is: is there any other ways I could retrieve gmail message with the poco library?所以,我的问题是:还有其他方法可以使用 poco 库检索 gmail 消息吗?
I posted this question on the poco github page.我在 poco github 页面上发布了这个问题。 the reponse is:回应是:
/////////// ///////////
Is there any other way I could retrieve gmail message?有没有其他方法可以检索 Gmail 邮件?
yes, with MailMessage::getContent()是的,使用 MailMessage::getContent()
/////////// ///////////
And it did solve my problem.它确实解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.