// IMAP Handler // // Douglas Thrift // // Tester.cpp #include "IMAPHandler.h" string program; bool debug = true; int main(int argc, char* argv[]) { program = argv[0]; IMAPHandler tester("imap.myrealbox.com", false); tester.capability(); tester.starttls(); tester.capability(); // tester.noop(); char* login = new char[32 + 1]; char* password = new char[32 + 1]; cout << "login: " << flush; cin.getline(login, 32); cout << "password: " << flush; cin.getline(password, 32); tester.login(string(login) + ' ' + password); memset(login, 0, strlen(login)); memset(password, 0, strlen(password)); delete [] login; delete [] password; cout << tester.list("\"\" *"); tester.status_("INBOX (MESSAGES UNSEEN)"); tester.examine("INBOX"); string message = string("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\r\n") + "From: Fred Foobar \r\n" + "Subject: afternoon meeting\r\n" + "To: mooch@owatagu.siam.edu\r\n" + "Message-Id: \r\n" + "MIME-Version: 1.0\r\n" + "Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\r\n\r\n" + "Hello Joe, do you think we can meet at 3:30 tomorrow?\r\n"; char length[4]; sprintf(length, "%u", message.length()); tester.append("INBOX {" + string(length) + "}", message); tester.noop(); tester.logout(); return 0; }