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:\openSSL\include
LIB = C:\openSSL\lib
(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)\Foundation\include;
$(POCO_BASE)\Net\include;
$(POCO_BASE)\NetSSL_OpenSSL\include;
$(POCO_BASE)\Crypto\include;
C:\OpenSSL\include
I don't know why they don't document this in some installation notes (I just did). Hope that helps.
精彩评论