sptk2 logo
SPTK Home Page

sptk::CSmtpConnect Class Reference
[Utility Classes]

SMTP socket. More...

#include <CSmtpConnect.h>

Inheritance diagram for sptk::CSmtpConnect:

sptk::CBaseMailConnect sptk::CSocket

List of all members.

Public Member Functions

 CSmtpConnect ()
 Default constructor.
 ~CSmtpConnect ()
 Destructor.
int command (std::string cmd, bool encodeCommand=false, bool decodeResponse=false)
CStringsresponse ()
 The response from the server - makes sence after calling any command.
void cmd_login (std::string user, std::string password)
 Logs in to the server host().
void cmd_send ()
 Sends the message.
void cmd_quit ()
 Ends the SMTP session.
virtual void sendMessage ()
 Sends the message.

Static Public Member Functions

static std::string stripHtml (const std::string &html)
 Strips HTML tags off the message, prepare the alternative text for an HTML message.

Protected Member Functions

void sendCommand (std::string cmd, bool encode=false)
 Sends command using SMTP protocol.
int getResponse (bool decode=false)
 Retrieves the server response after the command into internal CStrings buffer.

Static Protected Member Functions

static std::string mime (std::string s)
 Mime-encodes the string.
static std::string unmime (std::string s)
 Mime-decodes the string.


Detailed Description

SMTP socket.

Sends an e-mail message using SMTP protocol. It uses CSocket class to establish the connection, and CBaseMailConnect to make the complete RFC 822 message.


Member Function Documentation

void sptk::CSmtpConnect::cmd_login ( std::string  user,
std::string  password 
)

Logs in to the server host().

Parameters:
user std::string, user name
password std::string, user password

void sptk::CSmtpConnect::cmd_send (  ) 

Sends the message.

Message is based on the information defined by the methods from CBaseMailConnect, and retrieves the server output. An alias for sendMessage().

int sptk::CSmtpConnect::command ( std::string  cmd,
bool  encodeCommand = false,
bool  decodeResponse = false 
)

Sends command using SMTP protocol and retrieve the server response. The response can be read then with response() method. The CRLF characters after the command are added automatically.

Parameters:
cmd std::string, SMTP protocol command
encodeCommand bool, encode the comand argument to Base64 or not
decodeResponse bool, decode the response from Base64 or not

int sptk::CSmtpConnect::getResponse ( bool  decode = false  )  [protected]

Retrieves the server response after the command into internal CStrings buffer.

The response can be read then with response() method.

Parameters:
decode bool, decode the response from Base64 or not

void sptk::CSmtpConnect::sendCommand ( std::string  cmd,
bool  encode = false 
) [protected]

Sends command using SMTP protocol.

The CRLF characters after the command are added automatically.

Parameters:
cmd std::string, SMTP protocol command
encode bool, encode the arguments to Base64 or not

virtual void sptk::CSmtpConnect::sendMessage (  )  [virtual]

Sends the message.

The message based on the information defined by the methods from CBaseMailConnect, and retrieves the server output.

Implements sptk::CBaseMailConnect.

static std::string sptk::CSmtpConnect::stripHtml ( const std::string &  html  )  [static]

Strips HTML tags off the message, prepare the alternative text for an HTML message.

Parameters:
html const std::string&, the HTML text
Returns:
plain text with stripped HTML messages


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:06 2012: SPTK 3.5.7