#include <iostream>
#include <cstdlib>
#include "smtp.h"

using namespace std;
using namespace mail_tools;

int
main(int argc, char ** argv)
{
#ifdef __WIN32__
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);
#endif

   if(argc != 3) {
      cerr << "usage: smtp_test <port> <email-address>" << endl;
      exit(1);
   }
   int port = atoi(argv[1]);
   string email = argv[2];
   smtp email_message("127.0.0.1", port);
   email_message.set_from(email.c_str());
   email_message.set_to(email.c_str());
   email_message.set_subject("Hello, world!");
   email_message.set_message("Hello, mcoan...");
   cout << "send next..." << endl;
   email_message.send();
   cout << "message sent..." << endl;
#ifdef __WIN32__
WSACleanup();
#endif
   return 0;
}
