⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop3handlertest.cpp

📁 邮件相关
💻 CPP
字号:
// POP3Handlertest.cpp : Definiert den Einsprungpunkt f黵 die Konsolenanwendung.
//

#include "stdafx.h"
#include "POP3Handler.h"
#include "POP3Handlertest.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Das einzige Anwendungsobjekt

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
	{
	int nRetCode = 0;

	// MFC initialisieren, Ausgabe und Fehlermeldung bei Fehlern
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
		{
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
		}
	else
		{
		WORD wVersionRequested;
		WSADATA wsaData;
		int err;
 
		wVersionRequested = MAKEWORD(2, 2);
 
		err = WSAStartup( wVersionRequested, &wsaData );
		if ( err != 0 ) 
			{
			/* Tell the user that we could not find a usable */
			/* WinSock DLL.                                  */
			return FALSE;
			}
		else
			{
			}

		char username [64]; 
		cout << "Please enter your Username: ";
		cin  >> username;

		char password [64];
		cout << "Please enter your Password: ";
		cin  >> password;

		char hostname [128];
		cout << "Please enter your POP3 Hostname: ";
		cin  >> hostname;

		CPOP3Handler POP3;
		if (POP3.Connect (username, password, hostname))
			{
			cout << "connected to pop.puretec.de" << endl;

			CStdioFile STDF;
			STDF.Open ("TEST.txt", CFile::modeWrite|CFile::modeCreate);

			cout << "LIST"<<endl;
			STDF.WriteString (POP3.Get (LIST_AS_STRING));
			cout << endl;
			cout << "TOP"<<endl;
			STDF.WriteString (POP3.Get (TOP_AS_STRING));
			cout << endl;
			cout << "MAIL" << endl;
			STDF.WriteString (POP3.Get (MAIL_AS_STRING));

			STDF.Flush ();
			STDF.Close ();

			POP3.Disconnect ();
			}
		else
			cout << "Error connecting" << endl;
		}

	return nRetCode;
	}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -