【问题标题】:Unable to retrieve email content with Poco library无法使用 Poco 库检索电子邮件内容
【发布时间】:2017-10-26 21:21:45
【问题描述】:

当我尝试使用 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".
----

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);
}

所以,我的问题是:还有其他方法可以使用 poco 库检索 gmail 消息吗?

【问题讨论】:

    标签: c++ email gmail poco-libraries


    【解决方案1】:

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

    ///////////

    我还有其他方法可以检索 gmail 邮件吗?

    是的,使用 MailMessage::getContent()

    ///////////

    它确实解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-27
      • 1970-01-01
      • 2015-11-07
      • 2015-11-20
      • 1970-01-01
      • 2020-02-05
      • 2018-08-25
      • 1970-01-01
      相关资源
      最近更新 更多