English 中文(简体)
Pop3 help for a C++ implementation!
原标题:

Alright, so this is absolutely killing me... If anyone could help me, I would be the happiest man on the face of the earth...

So, I need to create a C++ email client for a project at school, and I ve been using the POCO open source C++ library, and I ve been fine for working with email servers that do not need SSL authentication, but anything that DOES require SSL, I ve had no luck...

Here is the documentation for POCO: http://pocoproject.org/docs/

When you go there, you have to click on POCO:Net, and then in the bottom left frame, there is a bunch of documentation for different NET objects... I ve particularly been using POP3ClientSession.

I ve installed OpenSSL and compiled the library with SSL support, but nothing seems to work... I ve also followed this tutorial: http://pocoproject.org/wiki/index.php/NetSSL

If ANYONE has experience with POCO, or is just 1337 at SSL/C++, if you could help me get this working I would very much appreciate it! I ve been working on this for the past 12 hours straight just to get SSL working, and have had 0 luck.

Well one of the things I m not even quite sure about is if I compiled it with SSL correctly... I installed OpenSSH on my machine, and recompiled everything (took an hour!!!). I seemed to have everything compiled, but when I went to use it with the following include statement:

#include "Poco/Net/SecureStreamSocket.h" 

Which is what the documentation told me to do, I got an error... They compiled in a folder called NetSSL_OpenSSL, so i took the headers and sources and copied them into the appropriate place in the Net folder, hoping for it to work. Afterwords I got another error:

fatal error C1083: Cannot open include file:  Poco/Crypto/X509Certificate.h : No such file or directory I dont see Crypto anywhere... 

But I do have the X509Certificate.h file... I even went as far as changing Crypto in the source to Net (because its the net folder that is now holding this file), but as I expect, that blew up in my face...

So, I guess the main question would be the following:

How can I send emails using POP3 with SSL sockets instead of the standard sockets used by the POP3ClientSession?

最佳回答

As the error states

fatal error C1083: Cannot open include file: Poco/Crypto/X509Certificate.h

This means it cant find the file, that is the only problem!!!

问题回答

For a novice, POCO has some configuration you need to do.

1) For SSL (are you using Microsoft OS?), use the recommended openSSL: http://slproweb.com/products/Win32OpenSSL.htm and download the *4th item in this rather strange web site - the 16MB developer version, not the "light" version (which doesn t have includes and other necessary stuff).

2) if you install into C:openSSL, add to the system environment vars

INCLUDE = C:openSSLinclude
LIB = C:openSSLlib

(edit the install base path to yours)

3) before running the build, edit (in POCO install root) buildwin.cmd; edit OPENSSL_DIR to match your install location

4) run the build (in my case, for ViStud 2005: build_vs80.cmd)

5) the build may still fail (!), go into Crypto and NetSSL_OpenSSL subdirectories, run the appropriate Visual Studio solution, and for each project go Config. Properties > Linker > General, and add $(YOUR_SSL_ROOT)lib to "Additional Library Directories" (where YOUR_SSL_ROOT is where you installed OpenSSL). For some reason this doesn t get set in these solution files.

6) finally (and I can see your thought process) there are several include paths for POCO; it s not just 1 big bucket of #includes. You need to include each of them individually for your projects. I d recommend making an environment variable like POCO_ROOT or POCO_HOME and then in your "additional include directories" add something like this:

$(POCO_BASE)Foundationinclude;
$(POCO_BASE)Netinclude;
$(POCO_BASE)NetSSL_OpenSSLinclude;
$(POCO_BASE)Cryptoinclude;
C:OpenSSLinclude

I don t know why they don t document this in some installation notes (I just did). Hope that helps.





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签