PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXSMTP
Class for processing the SMTP protocol.
#include <SFXSMTP.h.hpp>
class SFXSMTP;
SFMTYPEDEFCLASS(SFXSMTP)

Collaboration diagram

 Collaboration diagram of SFXSMTPClass

Description

Procedure to send a SMTP mail

  1. Create the instance of the SFXSMTP class. At this time, resources for sending a SMTP mail are not allocated.
  2. To perform the initialization for sending a SMTP mail, call the SFXSMTP::Open function. And then to connect to the SMTP server, call the SFXSMTP::Connect function. In the SFXSMTP::Connect function, register a callback function which will be notified of the completion of sending a SMTP mail.
  3. A SMTP mail can be sent when the connection to the SMTP server is established.
  4. Send a SMTP command to the SMTP server using the function such as SFXSMTP::SendCommand.(*)
  5. The callback function registered using the SFXSMTP::Connect function will be notified when the response to a SMTP command from the SMTP server is received.
  6. Get the response code and response text using the SFXSMTP::GetResponseCode and SFXSMTP::GetResponseText functions respectively.
  7. When finish sending a SMTP mail, call the SFXSMTP::SendQuitCommand function to send the QUIT command to the SMTP server. And finally after confirming the response from the SMTP server, call the SFXSMTP::Close function to terminate the connection to the SMTP server.
[Note] Note
(*)For the SMTP commands such as HELO or EHLO, special functions such as SFXSMTP::SendHeloCommand or SFXSMTP::SendEhloCommand are provided for sending, and functions such as SFXSMTP::GetHeloResponse or SFXSMTP::GetEhloResponse are provided for obtaining the responses.
[Note] Detailed information on the SMTP protocol

SMTP specification : RFC2821 (Simple Mail Transfer Protocol)

Reference

SFXSMTPSender | SFXPOP3 | SFXPOP3Receiver | Mail Sending

Member

Constructor/Destructor
SFXSMTP( Void )
Constructor of SFXSMTP class.
~SFXSMTP( Void )
Destructor of SFXSMTP class.
Public Functions
Void Cancel( Void )
Cancel sending a SMTP mail.
Void Close( Void )
Close the connection to the SMTP server.
SFCError Connect( SFXSocketAddressConstRef address , CallbackSPP spp , VoidPtr reference )
Connect to the SMTP server.
SFCError GetEhloResponse( SFXAnsiStringPtr domain , SFXAnsiStringPtr greet , SFXAnsiStringHandle extList , UInt32Ptr extCount )
Get the response to the EHLO command.
SFCError GetHeloResponse( SFXAnsiStringPtr domain , SFXAnsiStringPtr greet )
Get the response to the HELO command.
SFCError GetLocalAddress( SFXSocketAddressPtr result )
Get the local IP address and port number.
SFCError GetRemoteAddress( SFXSocketAddressPtr result )
Get the remote IP address and port number.
SInt32 GetResponseCode( Void )
Get the response code.
SFXAnsiString GetResponseText( Void )
Get the response text.
SFCError GetResponseText( SFXAnsiStringPtr result )
Get the response text.
Bool GetSSLMode( Void )
Get the SSL connection mode.
UInt32 GetTrustMode( Void )
Get the SSL trust mode.
SFCError Open( Void )
Perform the initialization for connecting to the SMTP server.
SFCError SendAuthCommand( AuthEnum auth )
Send the AUTH command.
SFCError SendAuthResponse( SFXAnsiStringConstRef str1 , SFXAnsiStringConstRef str2 = SFXAnsiString::EmptyInstance() , SFXAnsiStringConstRef str3 = SFXAnsiString::EmptyInstance() )
Send the answer to the response of the AUTH command.
SFCError SendCommand( ACharConstPtr command , UInt32 size )
SendCommand( SFXAnsiStringConstRef command )
Send the SMTP command.
SFCError SendDataCommand( Void )
Send the DATA command.
SFCError SendDataText( SFXAnsiStringConstRef text )
Send the mail text.
SFCError SendEhloCommand( SFXAnsiStringConstRef hostName )
Send the ELHO command.
SFCError SendHeloCommand( SFXAnsiStringConstRef hostName )
Send the HELO command.
SFCError SendMailCommand( SFXAnsiStringConstRef from )
Send the MAIL command.
SFCError SendNoopCommand( Void )
Send the NOOP command.
SFCError SendQuitCommand( Void )
Send the QUIT command.
SFCError SendRcptCommand( SFXAnsiStringConstRef to )
Send the RCPT command.
SFCError SendRsetCommand( Void )
Send the RSET command.
Void SetSSLMode( Bool isSSL )
Set the SSL connection mode.
SFCError SetTrustMode( UInt32 sslTrustMode )
Set the SSL trust mode.
Types
AuthEnum
Constants that represent SMTP authorization methods.
CallbackSPP
Prototype of the callback function.

SFXSMTP::SFXSMTP
Constructor of SFXSMTP class.
[ public, explicit ]
SFXSMTP(Void);

Description

Resources for sending a SMTP mail will not be allocated when the instance of the SFXSMTP class is created. Those resources will be allocated after calling the SFXSMTP::Open function.

Reference

SFXSMTP::Open


SFXSMTP::~SFXSMTP
Destructor of SFXSMTP class.
[ public, virtual ]
~SFXSMTP(Void);

Description

The SFXSMTP::Close function needs to be called before destroying the instance of the SFXSMTP class.

Reference

SFXSMTP::Close


SFXSMTP::Cancel
Cancel sending a SMTP mail.
[ public ]
Void Cancel(Void);

Description

The SFXTCPSocket::Cancel function is called internally in this function.

Reference

SFXSMTP::Close


SFXSMTP::Close
Close the connection to the SMTP server.
[ public ]
Void Close(Void);

Description

Resources for sending a SMTP mail will be released. If during processing, it will be canceled.

  
[Note] How to terminate the connection to the SMTP server

After confirming the response to the QUIT command sent by the SFXSMTP::SendQuitCommand function from the SMTP server, terminate the connection to the SMTP server using the SFXSMTP::Close function

Reference

SFXSMTP::SendQuitCommand | SFXSMTP::Connect


SFXSMTP::Connect
Connect to the SMTP server.
[ public ]
SFCError Connect(
    SFXSocketAddressConstRef address   // IP address and port number of the SMTP server
    CallbackSPP spp                    // callback function
    VoidPtr reference                  // argument for the callback
);

Argument

address

Specify the IP address and port number of the SMTP server.

Return value

  • Success : SFERR_NO_ERROR
  • If socket is not opened or it has already been connected (including connection processing) : SFERR_INVALID_STATE
  • If IP address and port number of the SMTP server have not been set : SFERR_INVALID_STATE
  • If failed to create the SFBNetMgr instance : SFERR_FAILED
  • If insufficient memory : SFERR_NO_MEMORY
  • For other network errors: get error value by SFBSocket::GetLastError function.

Description

[Caution] Error when connecting to the SMTP server

An error occurred when connecting to the SMTP server is notified to the callback function.

Reference

SFXSMTP::Open | SFXSMTP::Close


SFXSMTP::GetEhloResponse
Get the response to the EHLO command.
[ public, const ]
SFCError GetEhloResponse(
    SFXAnsiStringPtr domain       // domain name
    SFXAnsiStringPtr greet        // greeting message
    SFXAnsiStringHandle extList   // extension command
    UInt32Ptr extCount            // number of extension commands
);

Argument

domain

Specify a pointer to the variable to store the domain name obtained from the SMTP server. Specify null if unnecessary.

greet

Specify a pointer to the variable to store the greeting message obtained from the SMTP server. Specify null if unnecessary.

extList

Specify a handle to store the pointer to the list of extension commands obtained from the SMTP server. An array of SFXAnsiString is passed. This array must be released by the caller using the delete[] operator. Specify null if unnecessary.

extCount

Specify a pointer to the variable to store the number of extension commands obtained from the SMTP server. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If connection has not been established : SFERR_INVALID_STATE
  • If response code is not 250 : SFERR_FAILED
  • If insufficient memory : SFERR_NO_MEMORY

Description

The ELHO command is the command to start the session of sending a SMTP mail.

The SFXSMTP::GetEhloResponse function gets the response to the ELHO command sent by the SFXSMTP::SendEhloCommand function.

Reference

SFXSMTP::SendEhloCommand


SFXSMTP::GetHeloResponse
Get the response to the HELO command.
[ public, const ]
SFCError GetHeloResponse(
    SFXAnsiStringPtr domain   // domain name
    SFXAnsiStringPtr greet    // greeting message
);

Argument

domain

Specify a pointer to the variable to store the domain name obtained from the SMTP server. Specify null if unnecessary.

greet

Specify a pointer to the variable to store the greeting message obtained from the SMTP server. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If connection has not been established : SFERR_INVALID_STATE
  • If response code is not 250 : SFERR_FAILED
  • If insufficient memory : SFERR_NO_MEMORY

Description

The HELO command is the command to start the session of sending a SMTP mail.

The SFXSMTP::GetHeloResponse function gets the response to the HELO command sent by the SFXSMTP::SendHeloCommand command.

Reference

SFXSMTP::SendHeloCommand


SFXSMTP::GetLocalAddress
Get the local IP address and port number.
[ public, const ]
SFCError GetLocalAddress(
    SFXSocketAddressPtr result   // pointer to the variable to store the local IP address and port number
);

Return value

  • Success : SFERR_NO_ERROR
  • If connection has not been established : SFERR_INVALID_STATE
  • If argument is null : SFERR_INVALID_PARAM
  • For other network errors: get error value by SFBSocket::GetLastError function.

Description

[Note] Local IP address may be changed

There is a possibility that the local IP address may changed after connecting to the SMTP server.

Reference

SFXInetAddress::LocalInetAddress | SFXTCPSocket::GetLocalAddress


SFXSMTP::GetRemoteAddress
Get the remote IP address and port number.
[ public, const ]
SFCError GetRemoteAddress(
    SFXSocketAddressPtr result   // pointer to the variable to store the remote IP address and port number
);

Return value

  • Success : SFERR_NO_ERROR
  • If connection has not been established : SFERR_INVALID_STATE
  • If argument is null : SFERR_INVALID_PARAM

Description

[Note] Remote IP address may be changed

There is a possibility that the remote IP address may be changed after connecting to the SMTP server.

Reference

SFXTCPSocket::GetRemoteAddress


SFXSMTP::GetResponseCode
Get the response code.
[ public, const ]
SInt32 GetResponseCode(Void);

Return value

Return the 3-digit response code (decimal number).

Description

Detailed information on the response code of the SMTP command: RFC2821 ( Simple Mail Transfer Protocol )

Reference

SFXSMTP::GetResponseText | SFXSMTP::SendCommand


SFXSMTP::GetResponseText
Get the response text.
[ public, const ]
SFXAnsiString GetResponseText(Void);
[ public, const ]
SFCError GetResponseText(
    SFXAnsiStringPtr result   // pointer to the variable to store the response text from the SMTP server
);

Argument

result

Specify a pointer to the variable to store the response text obtained from the SMTP server.

Return value

  • Success : SFERR_NO_ERROR
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY

Description

[Note] About response text

Response text is the partial response message, which is the text removed the response code at the beginning and succeeding whitespace or hyphen("-") from the response message from the SMTP server.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::SendCommand


SFXSMTP::GetSSLMode
Get the SSL connection mode.
[ public, const ]
Bool GetSSLMode(Void);

Return value

  • If valid : true
  • Otherwise : false

Reference

SFXSMTP::SetSSLMode


SFXSMTP::GetTrustMode
Get the SSL trust mode.
[ public, const ]
UInt32 GetTrustMode(Void);

Description

The SSL trust mode can be one of the following values.

  • SSL_TRUST_MODE_FAIL
  • SSL_TRUST_MODE_CHECK
  • SSL_TRUST_MODE_IGNORE
  • SSL_TRUST_MODE_ALWAYS
[Note] Note
Detailed information: ISSL_NegotiateV in the BREW API Reference

Reference

BREW API ISSL_NegotiateV | SFXSMTP::SetTrustMode


SFXSMTP::Open
Perform the initialization for connecting to the SMTP server.
[ public ]
SFCError Open(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If socket has already been opened : SFERR_INVALID_STATE
  • If failed to create the instance of the SFBNetMgr or SFBSSL class : SFERR_FAILED
  • If failed : AEE_NET_ERROR

Description

The SFXTCPSocket::Open function is called internally in this function.

Reference

SFXSMTP::Close


SFXSMTP::SendAuthCommand
Send the AUTH command.
[ public ]
SFCError SendAuthCommand(
    AuthEnum auth   // authorization method
);

Argument

auth

Specify authorization method.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The AUTH command is the command for the SMTP authorization.

After receiving the response to the EHLO command, send the AUTH command to the SMTP server. PLAIN, LOGIN, and CRAM-MD5 are available for the authorization method.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Example

Perform the CRAM-MD5 authorization.

smtp.SendAuthCommand(SFXSMTP::AUTH_CRAM_MD5);

Reference

SFXSMTP::SendAuthResponse | SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendAuthResponse
Send the answer to the response of the AUTH command.
[ public ]
SFCError SendAuthResponse(
    SFXAnsiStringConstRef str1                                    // string 1 (differs depending on the authorization method)
    SFXAnsiStringConstRef str2 = SFXAnsiString::EmptyInstance()   // string 2 (differs depending on the authorization method)
    SFXAnsiStringConstRef str3 = SFXAnsiString::EmptyInstance()   // string 3 (differs depending on the authorization method)
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The AUTH command is the command for the SMTP authorization.

After sending the AUTH command to the SMTP server using the SFXSMTP::SendAuthCommand function, send the answer to its response from the SMTP server(The arguments differs depending on the authorization method).

In case of PLAIN:

  1. str1: username
  2. str2: password
  3. str3: not used

In case of LOGIN: First, execute SendAuthResponse(user). Second, execute SendAuthResponse(password) after receiving the response from the SMTP server.

In case of CRAM-MD5:

  1. str1: username
  2. str2: password
  3. str3 : Challenge code (text returned from the SMTP server)

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Example

Perform the CRAM-MD5 authorization.

smtp.SendAuthResponse("user", "password", smtp.GetResponseText());

Reference

SFXSMTP::SendAuthResponse | SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendCommand
Send the SMTP command.
[ public ]
SFCError SendCommand(
    ACharConstPtr command   // SMTP command
    UInt32 size             // size of the SMTP command
);
[ public ]
SFCError SendCommand(
    SFXAnsiStringConstRef command   // SMTP command
);

Argument

command

Specify a pointer to the SMTP command to be sent to the SMTP server.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendDataCommand
Send the DATA command.
[ public ]
SFCError SendDataCommand(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The DATA command is the command to be sent immediately before the mail text.

When the SMTP server receives this command, it sends 354 as response code which means to request for the mail text. After this, send the mail text using the SFXSMTP::SendDataText function.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::SendDataText | SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendDataText
Send the mail text.
[ public ]
SFCError SendDataText(
    SFXAnsiStringConstRef text   // mail
);

Argument

text

Specify a reference to the mail text.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The SFXSMTP::SendDataText function sends a mail text of mail header and its body. The mail header contains information such as host name of sender, mail address of sender, mail address of recipient, etc.

The mail text needs to be sent immediately after the SFXSMTP::SendDataCommand function.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::SendDataCommand | SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendEhloCommand
Send the ELHO command.
[ public ]
SFCError SendEhloCommand(
    SFXAnsiStringConstRef hostName   // host name
);

Argument

hostName

Specify a reference to the host name.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The ELHO command is the command to start the session of sending a SMTP mail.

The response message is obtained using the SFXSMTP::GetEhloResponse function.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetEhloResponse | SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendHeloCommand
Send the HELO command.
[ public ]
SFCError SendHeloCommand(
    SFXAnsiStringConstRef hostName   // host name
);

Argument

hostName

Specify a reference to the host name.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

HELO command is the command to start the session of sending a SMTP mail.

The response message is obtained using the SFXSMTP::GetHeloResponse function. The HELO command is for the compatibility with old servers, and is not recommended to use. Commonly, the ELHO command (SFXSMTP::SendEhloCommand function) is used.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::SendEhloCommand | SFXSMTP::GetHeloResponse | SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendMailCommand
Send the MAIL command.
[ public ]
SFCError SendMailCommand(
    SFXAnsiStringConstRef from   // mail address of the sender
);

Argument

from

Specify a reference to the mail address of the sender, which must be enclosed by <>.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The MAIL command is the command to set the mail address of the sender.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendNoopCommand
Send the NOOP command.
[ public ]
SFCError SendNoopCommand(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The NOOP command is the command to check the connection to the SMTP server.

When the SMTP server receives the NOOP command, it returns only the response message.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendQuitCommand
Send the QUIT command.
[ public ]
SFCError SendQuitCommand(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The QUIT command is the command to terminate the session of sending a SMTP mail.

[Note] How to terminate the connection to the SMTP server

After confirming the response to the QUIT command sent by the SFXSMTP::SendQuitCommand function from the SMTP server, terminate the connection to the SMTP server using the SFXSMTP::Close function

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendRcptCommand
Send the RCPT command.
[ public ]
SFCError SendRcptCommand(
    SFXAnsiStringConstRef to   // mail address of the recipient
);

Argument

to

Specify a reference to the mail address of the recipient, which must be enclosed by <>.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The RCPT command is the command to set the mail address of the recipient.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SendRsetCommand
Send the RSET command.
[ public ]
SFCError SendRsetCommand(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If connection has not been established : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • For other errors: error values are defined in AEEError.h

Description

The RSET command is the command to reset the session of sending a SMTP mail.

[Caution] Method to get the communication error and the command error

Only the error about the internal processing of this function will be returned as return value.

The communication error is notified to the callback function registered using the SFXSMTP::Connect function.

To check whether the command succeeded or not, use the SFXSMTP::GetResponseCode function.

Reference

SFXSMTP::GetResponseCode | SFXSMTP::GetResponseText | SFXSMTP::Connect


SFXSMTP::SetSSLMode
Set the SSL connection mode.
[ public ]
Void SetSSLMode(
    Bool isSSL   // whether or not to use SSL connection or not
);

Description

To use SSL connection, set true to the "isSSL" parameter.


SFXSMTP::SetTrustMode
Set the SSL trust mode.
[ public ]
SFCError SetTrustMode(
    UInt32 sslTrustMode   // SSL trust mode
);

Return value

  • Success : SFERR_NO_ERROR
  • If socket has been closed : SFERR_INVALID_STATE

Description

One of the following values are available for the SSL trust mode:

  • SSL_TRUST_MODE_FAIL: Default, fail on trust errors.
  • SSL_TRUST_MODE_CHECK: Suspend on trust errors so they can be checked and ignored.
  • SSL_TRUST_MODE_IGNORE: Ignore all trust errors.
  • SSL_TRUST_MODE_ALWAYS: Always suspend so trust can always be checked.
[Note] Note
Detailed information: ISSL_NegotiateV in the BREW API Reference

Reference

BREW API ISSL_NegotiateV | SFXSSLSocket::SetTrustMode


SFXSMTP::AuthEnum
Constants that represent SMTP authorization methods.
enum AuthEnum {
    AUTH_NONE,
    AUTH_PLAIN,
    AUTH_LOGIN,
    AUTH_CRAM_MD5,
    AUTH_DIGEST_MD5
};

Description

The SMTP authorization method is specified by the following constants using SFXSMTPSender::SetAuthorization function.

AUTH_NONE

SMTP authorization is not used.

AUTH_PLAIN

Represent PLAIN authorization.

AUTH_LOGIN

Represent LOGIN authorization.

AUTH_CRAM_MD5

Represent CRAM-MD5 authorization.

AUTH_DIGEST_MD5

Represent DIGEST-MD5 authorization (in the current version, DIGEST-MD5 authorization cannot be used.)

Reference

SFXSMTPSender::SetAuthorization


SFXSMTP::CallbackSPP
Prototype of the callback function.
typedef Void(* SFXSMTP::CallbackSPP)(SFCError error, VoidPtr reference)

Description

SFXSMTP::CallbackSPP is the prototype for the callback function used in the SFXSMTP class. This callback function is registered using the SFXSMTP::Connect function. The result of sending a SMTP mail is notified to this callback function.

As for the 1st argument "error": SFERR_NO_ERROR will be set if sending a SMTP mail succeeds, but an error code other than SFERR_NO_ERROR will be set if it fails.

As for the 2nd argument "reference": A parameter specified by the SFXSMTP::Connect function (in general, instance of the SFXSMTP class) is passed.

Reference

SFXSMTP::Connect