无法使用Poco库检索电子邮件内容

时间:2023-01-21 15:49:08

As I was trying to build an email client with Poco library. I found out that I can't retrieve content with the following method.

当我试图用Poco库构建一个电子邮件客户端时。我发现我无法使用以下方法检索内容。

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消息?

1 个解决方案

#1


0  

I posted this question on the poco github page. the reponse is:

我在poco github页面上发布了这个问题。回应是:

///////////

Is there any other way I could retrieve gmail message?

有没有其他方法可以检索gmail消息?

yes, with MailMessage::getContent()

是的,使用MailMessage :: getContent()

///////////

And it did solve my problem.

它确实解决了我的问题。

#1


0  

I posted this question on the poco github page. the reponse is:

我在poco github页面上发布了这个问题。回应是:

///////////

Is there any other way I could retrieve gmail message?

有没有其他方法可以检索gmail消息?

yes, with MailMessage::getContent()

是的,使用MailMessage :: getContent()

///////////

And it did solve my problem.

它确实解决了我的问题。