Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef SMTProtocolH
00040 #define SMTProtocolH
00041
00042
00043 #include <zeusbase/System/ZObject.h>
00044 #include <zeusbase/System/StringList.h>
00045 #include <zeusbase/Net/Protocols/EMail.h>
00046 #include <zeusbase/Net/PortDefines.hpp>
00047
00048 BEGIN_NAMESPACE_Zeus
00049
00050 class TSocket;
00051
00052
00061
00062 zeusbase_class TSMTProtocol : public TZObject
00063 {
00064 public:
00065 TSMTProtocol(const TString& rAddress, Uint uiPort = TCPPORT_SMTP);
00066 TSMTProtocol(TSocket& rSocket);
00067 TSMTProtocol(TSocket& rSocket, const TString& rLocalDomainName);
00068
00069 Retval authenticateSession(const TString& rUserName, const TString& rPassword);
00070 bool isAuthenticated() const;
00071 bool isConnected() const;
00072 Retval sendEMail(TEMail& rMail);
00073
00074 protected:
00075 virtual ~TSMTProtocol();
00076
00077 void close();
00078 void open(const TString& rLocalDomainName);
00079 bool listRecipients(const TSingleLinkedList<TEMailAddress>& rList);
00080 Uint sendCommand(const TString& rCommand);
00081 Uint sendCommand(const TString& rCommand, const TString& rArgument);
00082 Uint sendCommandWithResponse(const TString& rCommand, TStringList& rlstResponse);
00083 Uint sendCommandWithResponse(const TString& rCommand, const TString& rArgument, TStringList& rlstResponse);
00084
00085 private:
00087 TSocket& m_rSocket;
00089 bool m_bConnected;
00091 bool m_bAuthenticated;
00093 TString m_strLoginMethod;
00094
00095 Retval authenticateWith_CRAM_MD5(const TString& rUserName, const TString& rPassword, const TStringList& rlstAuthResponse);
00096 Retval authenticateWith_LOGIN(const TString& rUserName, const TString& rPassword);
00097 Retval authenticateWith_NTLM(const TString& rUserName, const TString& rPassword);
00098 };
00099
00100
00103
00104 inline bool TSMTProtocol::isAuthenticated() const
00105 {
00106 return m_bAuthenticated;
00107 }
00108
00109
00112
00113 inline bool TSMTProtocol::isConnected() const
00114 {
00115 return m_bConnected;
00116 }
00117
00118
00124
00125 inline Uint TSMTProtocol::sendCommand(const TString& rCommand, const TString& rArgument)
00126 {
00127 TStringList lstReturn;
00128 return sendCommandWithResponse(rCommand, rArgument, lstReturn);
00129 }
00130
00131
00136
00137 inline Uint TSMTProtocol::sendCommand(const TString& rCommand)
00138 {
00139 TStringList lstReturn;
00140 return sendCommandWithResponse(rCommand, lstReturn);
00141 }
00142
00143
00150
00151 inline Uint TSMTProtocol::sendCommandWithResponse(const TString& rCommand,
00152 const TString& rArgument,
00153 TStringList& rlstResponse)
00154 {
00155 TString strString(rCommand);
00156 strString += L" ";
00157 strString += rArgument;
00158 return sendCommandWithResponse(strString, rlstResponse);
00159 }
00160
00161
00162 END_NAMESPACE_Zeus
00163
00164 #endif