Menu

Working with a Procmail Dump

Help
hypknight
2016-04-09
2016-04-10
  • hypknight

    hypknight - 2016-04-09

    Hello All,
    Is there a portion of vmime which can open and manipulate a maildir exported via postfix -> procmail? I'm queueing messages this way and am looking to manipulate them with vmime.

    Thanks!
    Chris

     
  • hypknight

    hypknight - 2016-04-09

    I've currently tried this:

    /*
                 * Get the size of the file
                 */
                testFile.seekg(0, std::ios::end);
                std::streampos          length = testFile.tellg();
                testFile.seekg(0, std::ios::beg);
    
                /*
                 * Use a vector as the buffer.
                 * It is exception safe and will be tidied up correctly.
                 * This constructor creates a buffer of the correct length.
                 *
                 * Then read the whole file into the buffer.
                 */
                std::vector<char>       buffer(length);
                testFile.read(&buffer[0], length);
    
                /*
                 * Create your string stream.
                 * Get the stringbuffer from the stream and set the vector as it source.
                 */
                std::istringstream       localStream;
                localStream.rdbuf()->pubsetbuf(&buffer[0], length);
    
                const vmime::string msgString = localStream.str();
                vmime::messageParser mp(msgString);
    
                testFile.close();
    

    but am getting compiler errors like:

    undefined reference to `vmime::messageParser::messageParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    

    I've included:

    #include "vmime/vmime.hpp"
    #include "vmime/platforms/posix/posixHandler.hpp"
    

    and am able to reference it without Intellisense complaiing...

     
  • hypknight

    hypknight - 2016-04-10

    I think I'm having linker problems... I shifted to an example out of the book and I'm still getting things like:

    undefined reference to 'vtable for vmime::utility::stream'
    

    from the compiler... I'm using VisualGDB to develop on Linux in Visual Studio 2015... but the "make" line it sends to the compiler on the linux box looks right...

    it sends "-L/var/vmime/build/lib into the compiler (so it should have access to the library from there)

     
  • hypknight

    hypknight - 2016-04-10

    yep... i'm an idiot...

     
  • hypknight

    hypknight - 2016-04-10

    So everything compiles and all that jazz... but the message parser doesn't seem to be reading the email properly. Is there a reference that shows the types of message formats that can be parsed somewhere that I'm missing? My test message is a simple email (containing no mime)... Is this an issue?

    Thanks All,
    Chris

     
  • hypknight

    hypknight - 2016-04-10

    Specifically, the To() function results in a dump of the app when I call it...

    std::cout << "To:" << hdr->To()->getValue <vmime::mailbox>()->getEmail().toString();
    
     
  • Vincent Richard

    Vincent Richard - 2016-04-10

    Hello!

    VMime parser can parse RFC-(2)822 messages.
    Have you an excerpt of what you are trying to parse?

    If this is a maildir directory, you can use VMime maildir store (have a look at the book or at the samples). If this is a mailbox file (a file which contains a lot of RFC-822 messages), VMime cannot parse it out-of-the-box: you should first delimit and extract each message, then you can parse each one with VMime separately.

    Vincent

     

Log in to post a comment.