00001 #ifndef SMTPMAILER_H
00002 #define SMTPMAILER_H
00003
00004 #include <prtypes.h>
00005 #include <prmem.h>
00006 #include <prio.h>
00007 #include <prmon.h>
00008 #include <prerror.h>
00009 #include <prthread.h>
00010 #include <prnetdb.h>
00011 #include <iostream>
00012 #include <string>
00013
00014 using namespace std;
00015
00016 namespace net
00017 {
00023 class SMTPMailer
00024 {
00025 private:
00029 PRNetAddr mAddr;
00030
00034 PRFileDesc *mSock;
00035
00039 int mPort;
00040
00044 string mHost;
00045
00049 string mData;
00050
00054 string mSubject;
00055
00059 string mFrom;
00060
00064 string mTo;
00065
00069 string mError;
00070
00071
00076 string * Recv();
00077
00084 int Send(string aString);
00085
00090 void Disconnect();
00091
00097 int Connect(string aHost,int aPort);
00098
00099 public:
00103 SMTPMailer();
00104
00109 int SendMail();
00110
00115 void setSMTPHost(string aHost);
00116
00121 void setSMTPPort(int aPort);
00122
00127 void setMailData(string aData);
00128
00133 void setMailFrom(string aFrom);
00134
00139 void setMailTo(string aTo);
00140
00145 void setMailSubject(string aSubject);
00146
00150 string getError();
00151
00152 };
00153 }
00154 #endif
00155