Dacons LLP Mailit for C/C++ Version 1.0.8

EmaiSMTP.h File Reference

SMTP functionality. More...

#include <EmaiTypes.h>
#include <EmaiErrors.h>
#include <EmaiMessage.h>
#include <EmaiProxy.h>

Go to the source code of this file.

Classes

struct  EmaiSmtpCallbackData
 EmaiSmtpCallbackData structure. More...

Enumerations

enum  EmaiEnumSmtpSelector { EmaiSmtpSelectorNormal = 0, EmaiSmtpSelectorSending, EmaiSmtpSelectorServerError }
 Constants for selector member of the EmaiSmtpCallbackData structure/class. More...
enum  EmaiEnumSmtpOperationCode {
  EmaiSmtpConnectingToServer = 0, EmaiSmtpConnectedToServer, EmaiSmtpAuthenticating, EmaiSmtpAuthenticated,
  EmaiSmtpIntroducingSender, EmaiSmtpSenderIntroduced, EmaiSmtpSendingRecipients, EmaiSmtpRecipientsSent,
  EmaiSmtpSendingMessageData, EmaiSmtpMessageDataSent, EmaiSmtpSendingNOOP, EmaiSmtpNOOPSent,
  EmaiSmtpClosingConnection, EmaiSmtpConnectionClosed
}
 Constants for operation codes for smtp sessions. More...
enum  EmaiEnumSmtpSSL { EmaiSmtpUseSSLOption = 0x01 }
 Constants, used for session establishing function. More...
enum  EmaiEnumSmtpPorts { EmaiDefaultSmtpPort = 25, EmaiDefaultSmtpSSLPort = 465 }
 Constants for default SMTP port. More...
enum  EmaiEnumSmtpAuthSelector {
  EmaiSMTPAuthAutomatic, EmaiSMTPAuthLogin, EmaiSMTPAuthPlain, EmaiSMTPAuthCramMD5,
  EmaiSMTPAuthNTLM
}
 Constants for Authentication modes of the EmaiSmtpAuthenticate function. More...

Functions

 EmaiSmtpSessionCreate (EmaiSmtpSession *outSession, EmaiSmtpStatusCallback inStatusCallback, void *inUserData, EmaiUint32 inTimeout, EmaiOptions inOptions)
 Creates SMTP session object.
 EmaiSmtpConnect (EmaiSmtpSession inSession, EmaiConstUniCharPtr inMailServer, short inPort, EmaiOptions inOptions)
 Connects SMTP session object to the specified mail server.
 EmaiSmtpConnectEx (EmaiSmtpSession inSession, EmaiConstUniCharPtr inMailServer, short inPort, const EmaiProxyInfo *inProxyInfo, void *inUserData, EmaiOptions inOptions)
 Connects SMTP session object to the specified mail server.
 EmaiSmtpDisconnect (EmaiSmtpSession inSession, EmaiOptions inOptions)
 Disconnects SMTP session object from the mail server.
 EmaiSmtpAuthenticate (EmaiSmtpSession inSession, EmaiConstUniCharPtr inAccount, EmaiConstUniCharPtr inPassword, EmaiOptions inOptions)
 Authenticates the SMTP session.
 EmaiSmtpSendMessage (EmaiSmtpSession inSession, EmaiMessage inMessage, EmaiOptions inOptions)
 Sends the message.
 EmaiSmtpSendMessageEx (EmaiSmtpSession inSession, EmaiMessage inMessage, EmaiStringList *outFailedRecipients, EmaiOptions inOptions)
 Sends the message.
 EmaiSmtpCancel (EmaiSmtpSession inSession, EmaiOptions inOptions)
 Marks the SMTP session to be cancelled ASAP.
 EmaiSmtpNoop (EmaiSmtpSession inSession, EmaiOptions inOptions)
 Sends NOOP command to SMTP server, and reads server reply. Used to avoid timout disconnection, during inactivity period.
 EmaiSmtpSendCommand (EmaiSmtpSession inSession, const char *inCommand, EmaiUint32 inExpectedReplyCode, EmaiOptions inOptions)
 Sends a command to the SMTP server, reads server reply and compares server reply code with the expected one (passed via inExpectedReplyCode parameter).
Actual server answer can be accessed using EmaiSmtpGetLastServerResponse function.
 EmaiSmtpGetLastServerResponse (EmaiSmtpSession inSession, char *outResponse, EmaiUint32 *ioResponseSize, EmaiUint32 *outReplyCode, EmaiOptions inOptions)
 Retrieves the last SMTP server response.


Detailed Description

SMTP functionality.

Version:
Mailit for C/C++ 1.0
Author:
(C) 2008-2010 Dacons LLP.

Definition in file EmaiSMTP.h.


Enumeration Type Documentation

Constants for Authentication modes of the EmaiSmtpAuthenticate function.

See also:
EmaiSmtpAuthenticate()

Emai::SmtpSession::Authenticate()

Enumerator:
EmaiSMTPAuthAutomatic  Automatically tries all available mechanisms LOGIN authentification
EmaiSMTPAuthLogin  PLAIN authentification
EmaiSMTPAuthPlain  Cram-MD5 authentification
EmaiSMTPAuthCramMD5  NTLM authentification
EmaiSMTPAuthNTLM 

Definition at line 233 of file EmaiSMTP.h.

00234 {
00236     EmaiSMTPAuthAutomatic,
00237 
00239     EmaiSMTPAuthLogin,
00240 
00242     EmaiSMTPAuthPlain,
00243 
00245     EmaiSMTPAuthCramMD5,
00246 
00248     EmaiSMTPAuthNTLM
00249 };

Constants for operation codes for smtp sessions.

See also:
EmaiSmtpCallbackData
Enumerator:
EmaiSmtpConnectingToServer 
EmaiSmtpConnectedToServer 
EmaiSmtpAuthenticating 
EmaiSmtpAuthenticated 
EmaiSmtpIntroducingSender 
EmaiSmtpSenderIntroduced 
EmaiSmtpSendingRecipients 
EmaiSmtpRecipientsSent 
EmaiSmtpSendingMessageData 
EmaiSmtpMessageDataSent 
EmaiSmtpSendingNOOP 
EmaiSmtpNOOPSent 
EmaiSmtpClosingConnection 
EmaiSmtpConnectionClosed 

Definition at line 54 of file EmaiSMTP.h.

Constants for default SMTP port.

See also:
EmaiSmtpConnect

Emai::SmtpSession::Connect

Enumerator:
EmaiDefaultSmtpPort  Default SMTP port
EmaiDefaultSmtpSSLPort  Default SSL SMTP port

Definition at line 159 of file EmaiSMTP.h.

00160 {
00161     EmaiDefaultSmtpPort = 25,       
00162     EmaiDefaultSmtpSSLPort = 465    
00163 };

Constants for selector member of the EmaiSmtpCallbackData structure/class.

See also:
EmaiSmtpCallbackData

Emai::SmtpStatusCallback

Enumerator:
EmaiSmtpSelectorNormal  Normal
EmaiSmtpSelectorSending  Sending
EmaiSmtpSelectorServerError  ServerError

Definition at line 42 of file EmaiSMTP.h.

Constants, used for session establishing function.

See also:
EmaiSmtpSessionCreate

Emai::SmtpSession::SmtpSession

Enumerator:
EmaiSmtpUseSSLOption  If this flag is used, this session

Definition at line 126 of file EmaiSMTP.h.

00127 {
00128     EmaiSmtpUseSSLOption    = 0x01, 
00129                                 /* will connect only to secured SMTP servers.*/
00130 };


Function Documentation

EmaiSmtpAuthenticate ( EmaiSmtpSession  inSession,
EmaiConstUniCharPtr  inAccount,
EmaiConstUniCharPtr  inPassword,
EmaiOptions  inOptions 
)

Authenticates the SMTP session.

Parameters:
inSession - session object, to be authenticated
inAccount - pointer to null-teminated string, which conatins account name for authentication
inPassword - pointer to null-teminated string, which contains password for authentication
inOptions - preffered authentication method, i.e. EmaiSMTPAuthAutomatic, EmaiSMTPAuthLogin etc
See also:
EmaiEnumSmtpAuthSelector

Emai::SmtpSession::Authenticate

Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSessionInternal::Authenticate(), and Emai::SmtpSession::Authenticate().

EmaiSmtpCancel ( EmaiSmtpSession  inSession,
EmaiOptions  inOptions 
)

Marks the SMTP session to be cancelled ASAP.

Parameters:
inSession - session object, to be marked
inOptions - not used in current version, use EmaiNullOptions
See also:
Emai::SmtpSession::Cancel
Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSessionInternal::Cancel(), and Emai::SmtpSession::Cancel().

EmaiSmtpConnect ( EmaiSmtpSession  inSession,
EmaiConstUniCharPtr  inMailServer,
short  inPort,
EmaiOptions  inOptions 
)

Connects SMTP session object to the specified mail server.

Parameters:
inSession - session object to be connected
inMailServer - pointer to null-teminated string, which contains the name or IP address of the SMTP server
inPort - port number of the SMTP server
inOptions - not used in current version, use EmaiNullOptions
See also:
EmaiEnumSmtpPorts

Emai::SmtpSession::Connect

Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSession::Connect().

EmaiSmtpConnectEx ( EmaiSmtpSession  inSession,
EmaiConstUniCharPtr  inMailServer,
short  inPort,
const EmaiProxyInfo inProxyInfo,
void *  inUserData,
EmaiOptions  inOptions 
)

Connects SMTP session object to the specified mail server.

Parameters:
inSession - session object to be connected
inMailServer - pointer to null-teminated string, which contains the name or IP address of the SMTP server
inPort - port number of the SMTP server
inProxyInfo - proxy server information struct
inUserData - user data specified parameter, use NULL
inOptions - not used in current version, use EmaiNullOptions
See also:
EmaiEnumSmtpPorts

Emai::SmtpSession::ConnectEx

Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSession::ConnectEx().

EmaiSmtpDisconnect ( EmaiSmtpSession  inSession,
EmaiOptions  inOptions 
)

Disconnects SMTP session object from the mail server.

Parameters:
inSession - session object to be disconnected
inOptions - not used in current version, use EmaiNullOptions
See also:
Emai::SmtpSession::Disconnect
Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSessionInternal::Disconnect(), and Emai::SmtpSession::Disconnect().

EmaiSmtpGetLastServerResponse ( EmaiSmtpSession  inSession,
char *  outResponse,
EmaiUint32 *  ioResponseSize,
EmaiUint32 *  outReplyCode,
EmaiOptions  inOptions 
)

Retrieves the last SMTP server response.

Parameters:
inSession - session object to be used
outResponse - on exit contains zero terminated last server response
ioResponseSize - specifies outResponse buffer size, on exit filled with response length in bytes
outReplyCode - on exit contains reply code extracted from last server response string, specfy NULL if you don't need this infomation
inOptions - not used in current version, use EmaiNullOptions
Returns:
Result code (See EmaiEnumResultCodes)

EmaiSmtpNoop ( EmaiSmtpSession  inSession,
EmaiOptions  inOptions 
)

Sends NOOP command to SMTP server, and reads server reply. Used to avoid timout disconnection, during inactivity period.

Parameters:
inSession - session object
inOptions - not used in current version, use EmaiNullOptions
Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSessionInternal::Noop(), and Emai::SmtpSession::Noop().

EmaiSmtpSendCommand ( EmaiSmtpSession  inSession,
const char *  inCommand,
EmaiUint32  inExpectedReplyCode,
EmaiOptions  inOptions 
)

Sends a command to the SMTP server, reads server reply and compares server reply code with the expected one (passed via inExpectedReplyCode parameter).
Actual server answer can be accessed using EmaiSmtpGetLastServerResponse function.

Parameters:
inSession - session object, to be used for sending
inCommand - command to be sent to SMTP server
inExpectedReplyCode - expected server reply code, which means that command was accepted by server succesfully
inOptions - not used in current version, use EmaiNullOptions
Returns:
Return value:

EmaiSmtpSendMessage ( EmaiSmtpSession  inSession,
EmaiMessage  inMessage,
EmaiOptions  inOptions 
)

Sends the message.

Parameters:
inSession - session object, to be used for sending
inMessage - message to be sent
inOptions - not used in current version, use EmaiNullOptions
See also:
Emai::SmtpSession::SendMessage
Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSessionInternal::SendMessage(), and Emai::SmtpSession::SendMessage().

EmaiSmtpSendMessageEx ( EmaiSmtpSession  inSession,
EmaiMessage  inMessage,
EmaiStringList outFailedRecipients,
EmaiOptions  inOptions 
)

Sends the message.

Parameters:
inSession - session object, to be used for sending
inMessage - message to be sent
outFailedRecipients - failes recipients list
inOptions - not used in current version, use EmaiNullOptions
See also:
Emai::SmtpSession::SendMessage
Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSession::SendMessageEx().

EmaiSmtpSessionCreate ( EmaiSmtpSession *  outSession,
EmaiSmtpStatusCallback  inStatusCallback,
void *  inUserData,
EmaiUint32  inTimeout,
EmaiOptions  inOptions 
)

Creates SMTP session object.

Parameters:
outSession - on exit contains session object, to be used with other function calls
inStatusCallback - pointer to the callback function (used for status report)
inUserData - TODO
inTimeout - timeout in seconds
inOptions - use EmaiUseSSLOption option to create secured SSL session, or EmaiNullOptions otherwise
Returns:
Result code (See EmaiEnumResultCodes)

Referenced by Emai::SmtpSession::SmtpSession(), and Emai::SmtpSessionInternal::SmtpSessionInternal().