PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXMailUtility
Utility class for processing a mail message.
#include <SFXMailUtility.h.hpp>
class SFXMailUtility;
SFMTYPEDEFCLASS(SFXMailUtility)

Description

The SFXMailUtility class provides functions for parsing the header of the mail message based on RFC2822 (Internet Message Format) and the functions for processing about Base64, QuotedPrintable, MD5 etc.

To parse the entire mail message, use the SFXMailMessage class. While to parse the mail message in the MIME encode defined in RFC2047 (MIME Part Three : Message Header Extensions for Non-ASCII Text), use the SFXMailField class.

Reference

SFXMailMessage | SFXMailField

Member

Public Functions
static
SFCError
DecodeBase64( ACharConstPtr in , UInt32 size , SFXBufferPtr out )
DecodeBase64( SFXAnsiStringConstRef in , SFXAnsiStringPtr out )
DecodeBase64( SFXBufferConstRef in , SFXBufferPtr out )
Decode the data encoded in the Base64 format.
static
SFCError
DecodeQuotedPrintable( ACharConstPtr in , UInt32 size , SFXBufferPtr out , Bool text = true )
DecodeQuotedPrintable( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , Bool text = true )
DecodeQuotedPrintable( SFXBufferConstRef in , SFXBufferPtr out , Bool text = true )
Decode the data encoded in the Quoted-Printable format.
static
SFCError
EncodeBase64( ACharConstPtr in , UInt32 size , SFXBufferPtr out , UInt32 chars = 64 , SFXAnsiStringConstRef delimiter = "\r\n" )
EncodeBase64( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , UInt32 chars = 64 , SFXAnsiStringConstRef delimiter = "\r\n" )
EncodeBase64( SFXBufferConstRef in , SFXBufferPtr out , UInt32 chars = 64 , SFXAnsiStringConstRef delimiter = "\r\n" )
Encode the data in the Base64 format.
static
SFCError
EncodeQuotedPrintable( ACharConstPtr in , UInt32 size , SFXBufferPtr out , UInt32 chars = 64 , Bool text = true )
EncodeQuotedPrintable( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , UInt32 chars = 64 , Bool text = true )
EncodeQuotedPrintable( SFXBufferConstRef in , SFXBufferPtr out , UInt32 chars = 64 , Bool text = true )
Encode the data in the Quoted-Printable format.
static
Bool
FindNextBoundary( ACharConstPtr start , ACharConstPtr end , SFXAnsiStringConstRef boundary , ACharConstHandle found , ACharConstHandle next )
Find the next "boundary" string in the MIME document.
static
UInt32
GetEncodedSizeBase64( UInt32 size , UInt32 chars , UInt32 delimiter )
Get the size of the data when encoded in the Base64 format.
static
UInt32
GetEncodedSizeQuotedPrintable( ACharConstPtr in , UInt32 size , UInt32 chars , Bool text )
Get the size of the data when encoded in the Quoted-Printable format.
static
SFCError
GetHMACMD5( VoidConstPtr in , UInt32 size , SFXBufferConstRef key , SFXBufferPtr out , Bool isXdigit )
GetHMACMD5( SFXAnsiStringConstRef in , SFXAnsiStringConstRef key , SFXAnsiStringPtr out , Bool isXdigit )
GetHMACMD5( SFXBufferConstRef in , SFXBufferConstRef key , SFXBufferPtr out , Bool isXdigit )
Get the HMAC-MD5.
static
SFCError
GetKeyedMD5( VoidConstPtr datagram , UInt32 size , SFXBufferConstRef key , AChar keyfill , SFXBufferPtr out , Bool isXdigit )
GetKeyedMD5( SFXAnsiStringConstRef datagram , SFXAnsiStringConstRef key , AChar keyfill , SFXAnsiStringPtr out , Bool isXdigit )
GetKeyedMD5( SFXBufferConstRef datagram , SFXBufferConstRef key , AChar keyfill , SFXBufferPtr out , Bool isXdigit )
Get the Keyed-MD5.
static
SFCError
GetMD5( VoidConstPtr in , UInt32 size , SFXBufferPtr out , Bool isXdigit )
GetMD5( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , Bool isXdigit )
GetMD5( SFXBufferConstRef in , SFXBufferPtr out , Bool isXdigit )
Get the MD5.
static
SInt16
HexToByte( AChar c1 , AChar c2 )
Convert two hexadecimal digits into the integer value.
static
SInt16
HexToNibble( AChar c )
Convert one hexadecimal digit into the integer value.
static
Bool
IsAtext( AChar c )
Check whether a specified character is atext or not.
static
Bool
IsCTL( AChar c )
Check whether a specified character is control or not.
static
Bool
IsTokenChar( AChar c )
Check whether a specified character character is for token or not.
static
Bool
IsTspecials( AChar c )
Check whether a specified character character is TSPECIAL or not.
static
Bool
IsValidFieldName( ACharConstPtr start , ACharConstPtr end = null )
Check whether a specified field of the mail header is valid or not.
static
Bool
IsWSP( AChar c )
Check whether a specified character is white space or not.
static
SFCError
JISToShiftJIS( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , AChar unconvChar = '\0' )
Convert string in JIS code (iso-2022-jp) into Shift_JIS code.
static
AChar
NibbleToHex( Byte nibble )
Convert an integer value into a hexadecimal digit.
static
SFCError
ParseAddrSpec( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as mail address (addr-spec).
static
SFCError
ParseAtom( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as atom.
static
SFCError
ParseContentType( SFXAnsiStringConstRef fieldValue , SFXAnsiStringPtr mainType , SFXAnsiStringPtr subType , SFXPropertyPtr paramList )
Get a specified string as data of the Content-Type field.
static
SFCError
ParseDate( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXDatePtr date , SInt16Ptr zone )
ParseDate( SFXAnsiStringConstRef str , SFXDatePtr date , SInt16Ptr zone )
Get a specified string as date.
static
SFCError
ParseDotAtom( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as dot-atom.
static
SFCError
ParseDotAtomText( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as dot-atom-text.
static
SFCError
ParseHeaderLine( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value1 , SFXAnsiStringPtr value2 )
Get one line of the mail header.
static
SFCError
ParseMailbox( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr name , SFXAnsiStringPtr addr )
ParseMailbox( SFXAnsiStringConstRef str , SFXAnsiStringPtr name , SFXAnsiStringPtr addr )
Get a specified string as mail address (mail box).
static
SFCError
ParseMailboxList( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , MailboxHandle mailboxes , SInt32Ptr mbxCount )
ParseMailboxList( SFXAnsiStringConstRef str , MailboxHandle mailboxes , SInt32Ptr mbxCount )
Get a specified string as list of mail addresses (mailbox).
static
SFCError
ParseParameter( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr name , SFXAnsiStringPtr value )
Get a specified string as parameter.
static
SFCError
ParseParameterList( ACharConstPtr start , ACharConstPtr end , SFXPropertyPtr paramList )
Get a specified string as list of parameters.
static
SFCError
ParsePhrase( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as phrase.
static
SFCError
ParseQuotedString( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as quoted-string.
static
SFCError
ParseToken( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as token.
static
SFCError
ParseWord( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get a specified string as word.
static
SFCError
ShiftJISToJIS( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , AChar unconvChar = '\0' )
Convert a specified string in Shift_JIS code into JIS code (iso-2022-jp).
static
Void
SkipUntilCRLF( ACharConstHandle start )
Get the position of the next CRLF or '\0' chararacter.
Types
Mailbox
Structure that represents a mail address.

SFXMailUtility::DecodeBase64
Decode the data encoded in the Base64 format.
[ public, static ]
SFCError DecodeBase64(
    ACharConstPtr in   // pointer to the data encoded in the Base64 format
    UInt32 size        // size of the data encoded in the Base64 format
    SFXBufferPtr out   // pointer to the output buffer
);
[ public, static ]
SFCError DecodeBase64(
    SFXBufferConstRef in   // reference to the data encoded in the Base64 format
    SFXBufferPtr out       // pointer to the output buffer
);
[ public, static ]
SFCError DecodeBase64(
    SFXAnsiStringConstRef in   // reference to the data encoded in the Base64 format
    SFXAnsiStringPtr out       // pointer to the output buffer
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid character : SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::DecodeBase64 function decodes the data encoded in the Base64 format defined in RFC2045 (MIME Part One: Format of Internet Message Bodies).

The SFXMailUtility::DecodeBase64 function differs from the SFBWebUtil::DecodeBase64 function in that this function processes the line feed and carriage return characters.

Reference

SFXMailUtility::EncodeBase64 | SFBWebUtil::DecodeBase64


SFXMailUtility::DecodeQuotedPrintable
Decode the data encoded in the Quoted-Printable format.
[ public, static ]
SFCError DecodeQuotedPrintable(
    ACharConstPtr in   // pointer to the data encoded in the Quoted-Printable format
    UInt32 size        // size of the data encoded in the Quoted-Printable format
    SFXBufferPtr out   // pointer to the output buffer
    Bool text = true   // text mode
);
[ public, static ]
SFCError DecodeQuotedPrintable(
    SFXBufferConstRef in   // reference to the data encoded in the Quoted-Printable format
    SFXBufferPtr out       // pointer to the output buffer
    Bool text = true       // text mode
);
[ public, static ]
SFCError DecodeQuotedPrintable(
    SFXAnsiStringConstRef in   // reference to the data encoded in the Quoted-Printable format
    SFXAnsiStringPtr out       // pointer to the output buffer
    Bool text = true           // text mode
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid character : SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::DecodeQuotedPrintable function decodes the data encoded in the Quoted-Printable format defined in RFC2045 (MIME Part One: Format of Internet Message Bodies).

Invalid characters are ignored when decoding.

[Caution] Caution

If there are invalid characters, decoding ends normally though the return value is SFERR_INVALID_FORMAT.

Reference

SFXMailUtility::EncodeQuotedPrintable


SFXMailUtility::EncodeBase64
Encode the data in the Base64 format.
[ public, static ]
SFCError EncodeBase64(
    ACharConstPtr in                           // pointer to the data to be encoded
    UInt32 size                                // data size
    SFXBufferPtr out                           // pointer to the output buffer
    UInt32 chars = 64                          // number of characters per line
    SFXAnsiStringConstRef delimiter = "\r\n"   // line feed and carriage return characters
);
[ public, static ]
SFCError EncodeBase64(
    SFXBufferConstRef in                       // reference to the data to be encoded
    SFXBufferPtr out                           // pointer to the output buffer
    UInt32 chars = 64                          // number of characters per line
    SFXAnsiStringConstRef delimiter = "\r\n"   // line feed and carriage return characters
);
[ public, static ]
SFCError EncodeBase64(
    SFXAnsiStringConstRef in                   // reference to the data to be encoded
    SFXAnsiStringPtr out                       // pointer to the output buffer
    UInt32 chars = 64                          // number of characters per line
    SFXAnsiStringConstRef delimiter = "\r\n"   // line feed and carriage return characters
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::EncodeBase64 function encodes the data in the Base64 format defined in RFC2045 (MIME Part One: Format of Internet Message Bodies).

The SFXMailUtility::EncodeBase64 function differs from the SFBWebUtil::EncodeBase64 function in that this function processes the line feed and carriage return characters.

Reference

SFXMailUtility::DecodeBase64 | SFBWebUtil::EncodeBase64


SFXMailUtility::EncodeQuotedPrintable
Encode the data in the Quoted-Printable format.
[ public, static ]
SFCError EncodeQuotedPrintable(
    ACharConstPtr in    // pointer to the data to be encoded in the Quoted-Printable format
    UInt32 size         // data size
    SFXBufferPtr out    // pointer to the output buffer
    UInt32 chars = 64   // number of characters per line
    Bool text = true    // text mode or not?
);
[ public, static ]
SFCError EncodeQuotedPrintable(
    SFXBufferConstRef in   // reference to the data to be encoded in the Quoted-Printable format
    SFXBufferPtr out       // pointer to the output buffer
    UInt32 chars = 64      // number of characters of first line
    Bool text = true       // whether text mode or not?
);
[ public, static ]
SFCError EncodeQuotedPrintable(
    SFXAnsiStringConstRef in   // reference to the data to be encoded in the Quoted-Printable format
    SFXAnsiStringPtr out       // pointer to the output buffer
    UInt32 chars = 64          // number of characters of first line
    Bool text = true           // whether text mode or not
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::EncodeQuotedPrintable function encodes the data in the Quoted-Printable format defined in RFC2045 (MIME Part One: Format of Internet Message Bodies).

Reference

SFXMailUtility::DecodeQuotedPrintable


SFXMailUtility::FindNextBoundary
Find the next "boundary" string in the MIME document.
[ public, static ]
Bool FindNextBoundary(
    ACharConstPtr start              // pointer to the starting position to search for the "boundary" string
    ACharConstPtr end                // pointer to the end position to search for the "boundary" string
    SFXAnsiStringConstRef boundary   // "boundary" string
    ACharConstHandle found           // handle to store the pointer  to the position of the "boundary" string to be found
    ACharConstHandle next            // handle to store the pointer  to the next position of the "boundary" string to be found
);

Argument

start

Pointer to the head of the MIME document to be searched for.

end

Pointer to the end of the MIME document to be searched for. The character pointed by this pointer will not be searched for.

boundary

The "boundary" string to be searched for.

found

Handle to store the pointer to the CR character of the CRLF immediately before the "boundary" string to be found. Specify null if unnecessary.

next

Handle to store the pointer to the next character of the CRLF immediately after the "boundary" string to be found or the end position to search for the "boundary" string. Specify null if unnecessary.

Return value

Return true if the non-end-boundary is found.(end-boundary: string composed of '--' and "boundary" and '--')

Return false if the end-boundary is found.

Return false if the end-boundary is not found until the end of the MIME document to be searched for. In this case, the value of the "end" argument will be set to both the "found" and "next" argument.

Description

About boundary: RFC2049 (MIME Part Five : Conformance Criteria and Examples. Appendix A -- A Complex Multipart Example)


SFXMailUtility::GetEncodedSizeBase64
Get the size of the data when encoded in the Base64 format.
[ public, static ]
UInt32 GetEncodedSizeBase64(
    UInt32 size        // size of the data when encoded in the Base64 format
    UInt32 chars       // number of characters per line
    UInt32 delimiter   // length of the line feed and carriage return characters
);

SFXMailUtility::GetEncodedSizeQuotedPrintable
Get the size of the data when encoded in the Quoted-Printable format.
[ public, static ]
UInt32 GetEncodedSizeQuotedPrintable(
    ACharConstPtr in   // data to be encoded in the Quoted-Printable format
    UInt32 size        // size of the data when encoded in the Quoted-Printable format
    UInt32 chars       // number of characters per line
    Bool text          // whether text mode or not
);

SFXMailUtility::GetHMACMD5
Get the HMAC-MD5.
[ public, static ]
SFCError GetHMACMD5(
    VoidConstPtr in         // input data
    UInt32 size             // size of input data 
    SFXBufferConstRef key   // reference to the key 
    SFXBufferPtr out        // pointer to the output buffer
    Bool isXdigit           // whether or not to output the HMAC-MD5 as hexadecimal digits
);
[ public, static ]
SFCError GetHMACMD5(
    SFXBufferConstRef in    // input data
    SFXBufferConstRef key   // reference to the key 
    SFXBufferPtr out        // pointer to the output buffer
    Bool isXdigit           // whether or not to output the HMAC-MD5 as hexadecimal digits
);
[ public, static ]
SFCError GetHMACMD5(
    SFXAnsiStringConstRef in    // input data
    SFXAnsiStringConstRef key   // reference to the key 
    SFXAnsiStringPtr out        // pointer to the output string
    Bool isXdigit               // whether or not to output the HMAC-MD5 as hexadecimal digits
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Reference

SFXMailUtility::GetMD5 | SFXMailUtility::GetKeyedMD5


SFXMailUtility::GetKeyedMD5
Get the Keyed-MD5.
[ public, static ]
SFCError GetKeyedMD5(
    VoidConstPtr datagram   // input data
    UInt32 size             // size of input data 
    SFXBufferConstRef key   // reference to the key 
    AChar keyfill           // pad
    SFXBufferPtr out        // pointer to the output buffer
    Bool isXdigit           // whether or not to output the Keyed-MD5 as hexadecimal digits
);
[ public, static ]
SFCError GetKeyedMD5(
    SFXBufferConstRef datagram   // input data
    SFXBufferConstRef key        // reference to the key 
    AChar keyfill                // pad
    SFXBufferPtr out             // pointer to the output buffer
    Bool isXdigit                // whether or not to output the Keyed-MD5 as hexadecimal digits
);
[ public, static ]
SFCError GetKeyedMD5(
    SFXAnsiStringConstRef datagram   // input data
    SFXAnsiStringConstRef key        // key
    AChar keyfill                    // pad
    SFXAnsiStringPtr out             // pointer to the output string
    Bool isXdigit                    // whether or not to output the Keyed-MD5 as hexadecimal digits
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Reference

SFXMailUtility::GetMD5 | SFXMailUtility::GetHMACMD5


SFXMailUtility::GetMD5
Get the MD5.
[ public, static ]
SFCError GetMD5(
    VoidConstPtr in    // input data
    UInt32 size        // size of input data
    SFXBufferPtr out   // pointer to the output buffer
    Bool isXdigit      // whether or not to output the MD5 as hexadecimal digits
);
[ public, static ]
SFCError GetMD5(
    SFXBufferConstRef in   // input data
    SFXBufferPtr out       // pointer to the output buffer
    Bool isXdigit          // whether or not to output the MD5 as hexadecimal digits
);
[ public, static ]
SFCError GetMD5(
    SFXAnsiStringConstRef in   // input data
    SFXAnsiStringPtr out       // pointer to the output string
    Bool isXdigit              // whether or not to output the MD5 as hexadecimal digits
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::GetMD5 function is a wrapper function of the SFBHash class.

Reference

SFXMailUtility::GetKeyedMD5 | SFXMailUtility::GetHMACMD5 | SFBHash


SFXMailUtility::HexToByte
Convert two hexadecimal digits into the integer value.
[ public, static ]
SInt16 HexToByte(
    AChar c1   // upper character of two hexadecimal digits to be converted
    AChar c2   // lower character of two hexadecimal digits to be converted
);

Return value

  • Success : converted integer value
  • If failed : -1

Description

For example, 1B (c1 = '1', c2 = 'B') is converted into 27.

Reference

SFXMailUtility::HexToNibble


SFXMailUtility::HexToNibble
Convert one hexadecimal digit into the integer value.
[ public, static ]
SInt16 HexToNibble(
    AChar c   // hexadecimal digit to be converted
);

Return value

  • Success : converted integer value
  • If failed : -1

Description

For example, '1' is converted into 1, and 'f' is converted into 15.

Reference

SFXMailUtility::HexToByte | SFXMailUtility::NibbleToHex


SFXMailUtility::IsAtext
Check whether a specified character is atext or not.
[ public, static ]
Bool IsAtext(
    AChar c   // character to be checked
);

Argument

c

Specify the character to be checked.

Return value

  • If atext character : true
  • Otherwise : false

Description

Check whether or not a specified character is atext defined in RFC2822 (Internet Message Format) .

An atext character is an alphanumeric for atom, or a symbol such as "!", "#", "$", "%"

[Note] About atext

Refer to RFC2822 (Internet Message Format) .

Reference

SFXMailUtility::IsCTL | SFXMailUtility::IsTokenChar | SFXMailUtility::IsTspecials | SFXMailUtility::IsWSP


SFXMailUtility::IsCTL
Check whether a specified character is control or not.
[ public, static ]
Bool IsCTL(
    AChar c   // character to be checked
);

Argument

c

Specify the character to be checked.

Return value

  • If control character : true
  • Otherwise : false

Description

The code of control character is between "0x00" and "0x19", or "0x7f".

Reference

SFXMailUtility::IsAtext | SFXMailUtility::IsTokenChar | SFXMailUtility::IsTspecials | SFXMailUtility::IsWSP


SFXMailUtility::IsTokenChar
Check whether a specified character character is for token or not.
[ public, static ]
Bool IsTokenChar(
    AChar c   // character to be checked
);

Argument

c

Specify the character to be checked.

Return value

  • If character for token : true
  • Otherwise : false

Description

The SFXMailUtility::IsTokenChar function checks whether or not a specified character is for token defined in RFC2045 (MIME Part One : Format of Internet Message Bodies).

A character for token is any character except SPACE, CTLs, or TSPECIALs.

[Note] About a character for token

Refer to RFC2045 (MIME Part One : Format of Internet Message Bodies).

Reference

SFXMailUtility::IsAtext | SFXMailUtility::IsCTL | SFXMailUtility::IsTspecials | SFXMailUtility::IsWSP


SFXMailUtility::IsTspecials
Check whether a specified character character is TSPECIAL or not.
[ public, static ]
Bool IsTspecials(
    AChar c   // character to be checked
);

Argument

c

Specify the character to be checked.

Return value

  • TSPECIAL character : true
  • Not TSPECIAL character : false

Description

The SFXMailUtility::IsTspecials function checks whether or not a specified character is TSPECIAL defined in RFC2045 ( MIME Part One : Format of Internet Message Bodies ).

A TSPECIAL character is a symbol that needs to be quoted (") if the header field is treated as data.

Reference

SFXMailUtility::IsAtext | SFXMailUtility::IsCTL | SFXMailUtility::IsTokenChar | SFXMailUtility::IsWSP


SFXMailUtility::IsValidFieldName
Check whether a specified field of the mail header is valid or not.
[ public, static ]
Bool IsValidFieldName(
    ACharConstPtr start        // pointer to the starting character of the field
    ACharConstPtr end = null   // pointer to the end character of the field
);

Argument

start

Specify the head of the field.

end

Specify the end of the field. '\0' is regarded as the end character if null is specified.

Return value

  • If no ASCII value below 32 or above 127 : true
  • Otherwise : false

SFXMailUtility::IsWSP
Check whether a specified character is white space or not.
[ public, static ]
Bool IsWSP(
    AChar c   // character to be checked
);

Argument

c

Specify the character to be checked.

Return value

  • If white space character : true
  • Otherwise : false

Description

The SFXMailUtility::IsWSP function checks whether or not a specified character is white space defined in RFC2822 ( Internet Message Format ).

[Note] About white space character

Refer to RFC2822 (Internet Message Format).

Reference

SFXMailUtility::IsAtext | SFXMailUtility::IsCTL | SFXMailUtility::IsTokenChar | SFXMailUtility::IsTspecials


SFXMailUtility::JISToShiftJIS
Convert string in JIS code (iso-2022-jp) into Shift_JIS code.
[ public, static ]
SFCError JISToShiftJIS(
    SFXAnsiStringConstRef in   // reference to the string to be converted
    SFXAnsiStringPtr out       // pointer to the converted string
    AChar unconvChar = '\0'    // alternative character for the character that cannot be converted
);

Argument

in

Specify a string to be converted in JIS code (iso-2022-jp).

out

The pointer to the converted string will be returned.

unconvChar

Specify an alternative character for the character that cannot be converted. The default value of this argument is '\0', which means that this sub-function is invalid.

Return value

  • Success : SFERR_NO_ERROR
  • If there are some characters that cannot be converted: SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY

If the "unconvChar" argument is specified, characters that cannot be converted will be substituted with the value of the "unconvChar" argument and the return value will be SFERR_NO_ERROR.

Description

The half-width kana is supported.

Reference

SFXMailUtility::ShiftJISToJIS


SFXMailUtility::NibbleToHex
Convert an integer value into a hexadecimal digit.
[ public, static ]
AChar NibbleToHex(
    Byte nibble   // integre value to be converted
);

Return value

  • Success : converted value
  • If failed : -1 (AChar-casted)

Description

For example, 1 is converted into '1', and '11' is converted into 'B'.

Reference

SFXMailUtility::HexToNibble | SFXMailUtility::HexToByte


SFXMailUtility::ParseAddrSpec
Get a specified string as mail address (addr-spec).
[ public, static ]
SFCError ParseAddrSpec(
    ACharConstPtr start      // pointer to the head of string to be parsed
    ACharConstPtr end        // pointer to the end of string to be parsed
    ACharConstHandle next    // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr value   // pointer to the parsing result: mail address (addr-spec)
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed string of mail address(addr-spec). Specify null if unnecessary.

value

Specify a pointer to the variable to store the parsed string of mail address(addr-spec). Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::ParseAddrSpec function parses a specified string and get the parsed mail address, which is defined in RFC2822 (Internet Message Format).

The SFXMailUtility::ParseMailbox and SFXMailUtility::ParseMailboxList functions needs to be used when parsing the mail addresses of the "From:" and the "To:" fields.

Reference

SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseAtom
Get a specified string as atom.
[ public, static ]
SFCError ParseAtom(
    ACharConstPtr start      // pointer to the head of string to be parsed
    ACharConstPtr end        // pointer to the end of string to be parsed
    ACharConstHandle next    // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr value   // pointer to parsing result's atom
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this address is not parsed.

next

Specify a handle to store the pointer to the next character after the parsed string of atom. Specify null if unnecessary.

value

Specify a pointer to the variable to store the parsed string of atom. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If insufficient memory : SFERR_NO_MEMORY

Description

The SFXMailUtility::ParseAtom function parses a specified string and get the parsed atom, which is defined in RFC2822 (Internet Message Format).

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseContentType
Get a specified string as data of the Content-Type field.
[ public, static ]
SFCError ParseContentType(
    SFXAnsiStringConstRef fieldValue   // string to be parsed
    SFXAnsiStringPtr mainType          // type
    SFXAnsiStringPtr subType           // subtype
    SFXPropertyPtr paramList           // parameter
);

Argument

fieldValue

Specify a string to be parsed.

mainType

Specify a pointer to the variable to store the parsed string of Content-Type. Specify null if unnecessary.

subType

Specify a pointer to the variable to store the parsed string of Content-Subtype. Specify null if unnecessary.

paramList

Specify a pointer to the variable to store the parsed list of parameters. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::ParseContentType function parses a specified string and get the parsed data of the Content-Type field, which is defined in RFC2045 (MIME Part One : Format of Internet Message Bodies).

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseDate
Get a specified string as date.
[ public, static ]
SFCError ParseDate(
    ACharConstPtr start     // pointer to the head of string to be parsed
    ACharConstPtr end       // pointer to the end of string to be parsed
    ACharConstHandle next   // handle of the pointer to the end position to be parsed
    SFXDatePtr date         // pointer to the date
    SInt16Ptr zone          // pointer to the timezone
);
[ public, static ]
SFCError ParseDate(
    SFXAnsiStringConstRef str   // string to be parsed
    SFXDatePtr date             // pointer to the date
    SInt16Ptr zone              // pointer to the timezon
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed date. Specify null if unnecessary.

dateTime

Specify a pointer to the variable to store the parsed date. Specify null if unnecessary.

zone

Specify a pointer to the variable to store the parsed timezone, which is different from the UTC. Specify null if unnecessary.

str

Specify a string to be parsed.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If insufficient memory : SFERR_NO_MEMORY

Description

The SFXMailUtility::ParseDate function parses a specified string and get the parsed date, which is defined in RFC2822 (Internet Message Format).

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseDotAtom
Get a specified string as dot-atom.
[ public, static ]
SFCError ParseDotAtom(
    ACharConstPtr start      // pointer to the head of string to be parsed
    ACharConstPtr end        // pointer to the end of string to be parsed
    ACharConstHandle next    // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr value   // pointer to the parsing result: dot-atom
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed dot-atom. Specify null if unnecessary.

value

Specify a pointer to the variable to store the parsed dot-atom. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If insufficient memory : SFERR_NO_MEMORY

Description

The SFXMailUtility::ParseDotAtom function parses a specified string and get the parsed dot-atom, which is defined in RFC2822 ( Internet Message Format ).

The dot-atom differs from the dot-atom-text only in that there may be the white space characters in the beginning or end of the dot-atom.

The SFXMailUtility::ParseDotAtom function skips the biginning white space characters of a specified string.

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseDotAtomText
Get a specified string as dot-atom-text.
[ public, static ]
SFCError ParseDotAtomText(
    ACharConstPtr start      // pointer to the head of string to be parsed
    ACharConstPtr end        // pointer to the end of string to be parsed
    ACharConstHandle next    // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr value   // pointer to the parsing result: dot-atom-text
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed dot-atom-text. Specify null if unnecessary.

value

Specify a pointer to the variable to store the parsed dot-atom-text. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If insufficient memory : SFERR_NO_MEMORY

Description

The SFXMailUtility::ParseDotAtomText function parses a specified string and get the parsed dot-atom-text, which is defined in RFC2822 ( Internet Message Format ).

The dot-atom-text is a string that consists of atext and period '.'. In the dot-atom-text, a period cannot be put at the beginning or end and two successive periods cannot be permitted .

The SFXMailUtility::ParseDotAtomText function does not skip the biginning white space characters of a specified string.

If the first character of a specified string is white space, SFERR_INVALID_FORMAT will be returned.

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseHeaderLine
Get one line of the mail header.
[ public, static ]
SFCError ParseHeaderLine(
    ACharConstPtr start       // pointer to the head of string to be parsed
    ACharConstPtr end         // pointer to the end of string to be parsed
    ACharConstHandle next     // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr value1   // pointer to the parsing result: field name
    SFXAnsiStringPtr value2   // pointer to the parsing result: field value
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next line. Specify null if unnecessary.

value1

Specify a pointer to the variable to store the parsed field name. Specify null if unnecessary.

value2

Specify a pointer to the variable to store the parsed field value. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::ParseHeaderLine function parses and gets one line of the mail header. A line can be also obtained correctly even if the mail header is divided into multiple lines (from line 2, it starts from WSP).


SFXMailUtility::ParseMailbox
Get a specified string as mail address (mail box).
[ public, static ]
SFCError ParseMailbox(
    ACharConstPtr start     // pointer to the head of string to be parsed
    ACharConstPtr end       // pointer to the end of string to be parsed
    ACharConstHandle next   // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr name   // pointer to the parsing result name
    SFXAnsiStringPtr addr   // pointer to the parsing result's mail address (maibox) 
);
[ public, static ]
SFCError ParseMailbox(
    SFXAnsiStringConstRef str   // string to be parsed
    SFXAnsiStringPtr name       // pointer to the parsed name
    SFXAnsiStringPtr addr       // pointer to the parsing result:  mail address (maibox) 
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed mail address. Specify null if unnecessary.

name

Specify a pointer to the variable to store the parsed name. Specify null if unnecessary.

addr

Specify a pointer to the variable to store the parsed mail address. Specify null if unnecessary.

str

Specify a string to be parsed.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::ParseMailbox function parses a specified string and get the parsed mail address(mailbox), which is defined in RFC2822 (Internet Message Format).

The SFXMailUtility::ParseMailbox function can parse the "addr-spec" format of (1) and (2), and the "name-addr" format of (3).

  1. my@example.com

  2. my@example.com (My Name)

  3. My Name <my@example.com>

In case of (2) and (3), dispaly name (My Name) can also be obtained. The SFXMailUtility::ParseMailbox function can parse only one mailbox.

To parse the list of mailboxes, use the SFXMailUtility::ParseMailboxList function.

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailboxList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseMailboxList
Get a specified string as list of mail addresses (mailbox).
[ public, static ]
SFCError ParseMailboxList(
    ACharConstPtr start       // pointer to the head of string to be parsed
    ACharConstPtr end         // pointer to the end of string to be parsed
    ACharConstHandle next     // handle of the pointer to the end position to be parsed
    MailboxHandle mailboxes   // list of mail address
    SInt32Ptr mbxCount        // number of mail addresses
);
[ public, static ]
SFCError ParseMailboxList(
    SFXAnsiStringConstRef str   // character string to be parsed
    MailboxHandle mailboxes     // list of mail address
    SInt32Ptr mbxCount          // number of mail addresses
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed mail addresses. Specify null if unnecessary.

mailboxes

Specify a handle to store the pointer to the parsed list of mail addresses. The SFXMailUtility::Mailbox array will be passed.

This array must be released using the "delete[]" operator by the caller. Specify null if unnecessary.

mbxCount

Specify a pointer to the variable to store the parsed number of mail addresses. The parsed will be returned. Specify null if unnecessary.

str

Specify a string to be parsed.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The SFXMailUtility::ParseMailboxList function parses a specified string and get the parsed list of mail addresses (mailbox), which is defined in RFC2822 (Internet Message Format).

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseParameter | SFXMailUtility::ParseParameterList | SFXMailUtility::ParsePhrase | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::ParseWord


SFXMailUtility::ParseParameter
Get a specified string as parameter.
[ public, static ]
SFCError ParseParameter(
    ACharConstPtr start      // pointer to the head of string to be parsed
    ACharConstPtr end        // pointer to the end of string to be parsed
    ACharConstHandle next    // handle of the pointer to the end position to be parsed
    SFXAnsiStringPtr name    // pointer to the parsed name of parameter
    SFXAnsiStringPtr value   // pointer to the parsed value of parameter
);

Argument

start

Specify a pointer to the head of string to be parsed.

end

Specify a pointer to the end of string to be parsed. The character pointed by this pointer will not be parsed.

next

Specify a handle to store the pointer to the next character after the parsed parameter. Specify null if unnecessary.

name

Specify a pointer to the variable to store the parsed name of parameter. Specify null if unnecessary.

value

Specify a pointer to the variable to store the parsed value of parameter. Specify null if unnecessary.

Return value

  • Success : SFERR_NO_ERROR
  • If invalid string format : SFERR_INVALID_FORMAT
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY

Description

The SFXMailUtility::ParseParameter function parses a specified string and get the parameter like "attribute = value", which is defined in RFC2045 (MIME Part One: Format of Internet Message Bodies) .

The SFXMailUtility::ParseParameter function can parse only one parameter.

To parse the list of parameters, use the SFXMailUtility::ParseParameterList function.

Reference

SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParseAtom | SFXMailUtility::ParseContentType | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList |