PrevNextUpHome SophiaFramework UNIVERSE 5.3
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 )
Decode the data encoded in the Base64 format.
static
SFCError
DecodeBase64( SFXBufferConstRef in , SFXBufferPtr out )
Decode the data encoded in the Base64 format.
static
SFCError
DecodeBase64( SFXAnsiStringConstRef in , SFXAnsiStringPtr out )
Decode the data encoded in the Base64 format.
static
SFCError
DecodeQuotedPrintable( ACharConstPtr in , UInt32 size , SFXBufferPtr out , Bool text = true )
Decode the data encoded in the Quoted-Printable format.
static
SFCError
DecodeQuotedPrintable( SFXBufferConstRef in , SFXBufferPtr out , Bool text = true )
Decode the data encoded in the Quoted-Printable format.
static
SFCError
DecodeQuotedPrintable( SFXAnsiStringConstRef in , SFXAnsiStringPtr 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" )
Encode the data in the Base64 format.
static
SFCError
EncodeBase64( SFXBufferConstRef in , SFXBufferPtr out , UInt32 chars = 64 , SFXAnsiStringConstRef delimiter = "\r\n" )
Encode the data in the Base64 format.
static
SFCError
EncodeBase64( SFXAnsiStringConstRef in , SFXAnsiStringPtr 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 )
Encode the data in the Quoted-Printable format.
static
SFCError
EncodeQuotedPrintable( SFXBufferConstRef in , SFXBufferPtr out , UInt32 chars = 64 , Bool text = true )
Encode the data in the Quoted-Printable format.
static
SFCError
EncodeQuotedPrintable( SFXAnsiStringConstRef in , SFXAnsiStringPtr 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 )
Get the HMAC-MD5.
static
SFCError
GetHMACMD5( SFXBufferConstRef in , SFXBufferConstRef key , SFXBufferPtr out , Bool isXdigit )
Get the HMAC-MD5.
static
SFCError
GetHMACMD5( SFXAnsiStringConstRef in , SFXAnsiStringConstRef key , SFXAnsiStringPtr out , Bool isXdigit )
Get the HMAC-MD5.
static
SFCError
GetKeyedMD5( VoidConstPtr datagram , UInt32 size , SFXBufferConstRef key , AChar keyfill , SFXBufferPtr out , Bool isXdigit )
Get the Keyed-MD5.
static
SFCError
GetKeyedMD5( SFXBufferConstRef datagram , SFXBufferConstRef key , AChar keyfill , SFXBufferPtr out , Bool isXdigit )
Get the Keyed-MD5.
static
SFCError
GetKeyedMD5( SFXAnsiStringConstRef datagram , SFXAnsiStringConstRef key , AChar keyfill , SFXAnsiStringPtr out , Bool isXdigit )
Get the Keyed-MD5.
static
SFCError
GetMD5( VoidConstPtr in , UInt32 size , SFXBufferPtr out , Bool isXdigit )
Get the MD5.
static
SFCError
GetMD5( SFXBufferConstRef in , SFXBufferPtr out , Bool isXdigit )
Get the MD5.
static
SFCError
GetMD5( SFXAnsiStringConstRef in , SFXAnsiStringPtr 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 or not the specified character is atext.
static
Bool
IsCTL( AChar c )
Check whether or not the specified character is control.
static
Bool
IsTokenChar( AChar c )
Check whether or not the specified character is for token.
static
Bool
IsTspecials( AChar c )
Check whether or not the specified character is TSPECIAL.
static
Bool
IsValidFieldName( ACharConstPtr start , ACharConstPtr end = null )
Check whether or not the specified string is valid for the field name of the mail header.
static
Bool
IsWSP( AChar c )
Check whether or not the specified character is a white space(a space character or a tab character).
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 the specified string as mail address (addr-spec).
static
SFCError
ParseAtom( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the specified string as atom.
static
SFCError
ParseContentType( SFXAnsiStringConstRef fieldValue , SFXAnsiStringPtr mainType , SFXAnsiStringPtr subType , SFXPropertyPtr paramList )
Get the specified string as data of the Content-Type field.
static
SFCError
ParseDate( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXDatePtr date , SInt16Ptr zone )
Get the specified string as date.
static
SFCError
ParseDate( SFXAnsiStringConstRef str , SFXDatePtr date , SInt16Ptr zone )
Get the specified string as date.
static
SFCError
ParseDotAtom( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the specified string as dot-atom.
static
SFCError
ParseDotAtomText( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the 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 )
Get the specified string as mail address (mail box).
static
SFCError
ParseMailbox( SFXAnsiStringConstRef str , SFXAnsiStringPtr name , SFXAnsiStringPtr addr )
Get the specified string as mail address (mail box).
static
SFCError
ParseMailboxList( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , MailboxHandle mailboxes , SInt32Ptr mbxCount )
Get the specified string as list of mail addresses (mailbox).
static
SFCError
ParseMailboxList( SFXAnsiStringConstRef str , MailboxHandle mailboxes , SInt32Ptr mbxCount )
Get the specified string as list of mail addresses (mailbox).
static
SFCError
ParseParameter( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr name , SFXAnsiStringPtr value )
Get the specified string as parameter.
static
SFCError
ParseParameterList( ACharConstPtr start , ACharConstPtr end , SFXPropertyPtr paramList )
Get the specified string as list of parameters.
static
SFCError
ParsePhrase( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the specified string as phrase.
static
SFCError
ParseQuotedString( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the specified string as quoted-string.
static
SFCError
ParseToken( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the specified string as token.
static
SFCError
ParseWord( ACharConstPtr start , ACharConstPtr end , ACharConstHandle next , SFXAnsiStringPtr value )
Get the specified string as word.
static
SFCError
ShiftJISToJIS( SFXAnsiStringConstRef in , SFXAnsiStringPtr out , AChar unconvChar = '\0' )
Convert the 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.
static
Void
SkipWSP( ACharConstHandle start , ACharConstPtr end )
Advance the pointer to the first character other than WSP(space or horizontal tab) or the ending position specified.
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

  • If succeeds: SFERR_NO_ERROR
  • If invalid characters are included: SFERR_INVALID_FORMAT
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Description

This function decodes the data encoded in the Base64 format.

This function differs from the SFBWebUtil::DecodeBase64 function in that the delimiter string will be processed(or ignored).

[Note] About Base64

For more detailed information, see RFC2045: 6.8. Base64 Content-Transfer-Encoding

Reference

SFXMailUtility::EncodeBase64 | SFXMailUtility::GetEncodedSizeBase64 | BREW API IWEBUTIL_DecodeBase64 | RFC2045: 6.8. Base64 Content-Transfer-Encoding


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

  • If succeeds: SFERR_NO_ERROR
  • If invalid characters are included: SFERR_INVALID_FORMAT
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Description

This function decodes the data encoded in the Quoted-Printable format.

Invalid characters and CRLF characters are ignored when decoding.

[Caution] Caution

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

[Note] About Quoted-Printable

For more detailed information, see RFC2045: 6.7. Quoted-Printable Content-Transfer-Encoding

Reference

SFXMailUtility::EncodeQuotedPrintable | SFXMailUtility::GetEncodedSizeQuotedPrintable | RFC2045: 6.7. Quoted-Printable Content-Transfer-Encoding


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"   // CRLF characters
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Description

This function encodes the data in the Base64 format.

This function differs from the SFBWebUtil::EncodeBase64 function in that the delimiter string will be processed.

[Note] About Base64

For more detailed information, see RFC2045: 6.8. Base64 Content-Transfer-Encoding

Reference

SFXMailUtility::DecodeBase64 | SFXMailUtility::GetEncodedSizeBase64 | SFBWebUtil::EncodeBase64 | BREW API IWEBUTIL_EncodeBase64 | RFC2045: 6.8. Base64 Content-Transfer-Encoding


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

  • If succeeds: SFERR_NO_ERROR
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Description

This function encodes the data in the Quoted-Printable format.

The CRLF characters will be appended at the end of each line when encoding.

[Note] About Quoted-Printable

For more detailed information, see RFC2045: 6.7. Quoted-Printable Content-Transfer-Encoding

Reference

SFXMailUtility::DecodeQuotedPrintable | SFXMailUtility::GetEncodedSizeQuotedPrintable | RFC2045: 6.7. Quoted-Printable Content-Transfer-Encoding


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 "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)

Reference

RFC2046: 5.1. Multipart Media Type


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
);

Reference

SFXMailUtility::EncodeBase64 | SFXMailUtility::DecodeBase64 | RFC2045: 6.8. Base64 Content-Transfer-Encoding


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
);

Reference

SFXMailUtility::EncodeQuotedPrintable | SFXMailUtility::DecodeQuotedPrintable | RFC2045: 6.7. Quoted-Printable Content-Transfer-Encoding


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

  • If succeeds: SFERR_NO_ERROR
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Reference

SFXMailUtility::GetMD5 | SFXMailUtility::GetKeyedMD5 | RFC2104: HMAC: Keyed-Hashing for Message Authentication | RFC1321: The MD5 Message-Digest Algorithm


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

  • If succeeds: SFERR_NO_ERROR
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Reference

SFXMailUtility::GetMD5 | SFXMailUtility::GetHMACMD5 | RFC1828: IP Authentication using Keyed MD5 | RFC1321: The MD5 Message-Digest Algorithm


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

  • If succeeds: SFERR_NO_ERROR
  • If the out argument is null: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY

Description

This function uses the SFBHash class internally.

Reference

SFXMailUtility::GetKeyedMD5 | SFXMailUtility::GetHMACMD5 | SFBHash | RFC1321: The MD5 Message-Digest Algorithm


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

  • If succeeds: 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

  • If succeeds: 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 or not the specified character is atext.
[ 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

This function checks whether or not the specified character is atext.

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

[Note] About atext

For more detailed information, see RFC2822: 3.2.4. Atom.

Reference

SFXMailUtility::ParseAtom | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::IsCTL | SFXMailUtility::IsTokenChar | SFXMailUtility::IsTspecials | SFXMailUtility::IsWSP | RFC2822: 3.2.4. Atom


SFXMailUtility::IsCTL
Check whether or not the specified character is control.
[ 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 a control character is greater than or equals "0x00" and less than or equals "0x1F", or "0x7F".

Reference

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


SFXMailUtility::IsTokenChar
Check whether or not the specified character is for token.
[ 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

This function checks whether or not the specified character is for a token.

[Note] About a character for token

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

For more detailed information, see RFC2045: Appendix A -- Collected Grammar.

Reference

SFXMailUtility::ParseToken | SFXMailUtility::IsAtext | SFXMailUtility::IsCTL | SFXMailUtility::IsTspecials | SFXMailUtility::IsWSP | RFC2045: Appendix A -- Collected Grammar


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

Argument

c

Specify the character to be checked.

Return value

  • If the TSPECIAL character: true
  • Otherwise: false

Description

This function checks whether or not the specified character is TSPECIAL.

[Note] About TSPECIAL

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

For more detailed information, see RFC2045: Appendix A -- Collected Grammar.

Reference

SFXMailUtility::IsAtext | SFXMailUtility::IsCTL | SFXMailUtility::IsTokenChar | SFXMailUtility::IsWSP | RFC2045: Appendix A -- Collected Grammar


SFXMailUtility::IsValidFieldName
Check whether or not the specified string is valid for the field name of the mail header.
[ 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 the US-ASCII value of the specified character is greater than "0x20" and less than "0x7F" except "0x3A"(=":"): true
  • Otherwise: false

Reference

SFXMailUtility::ParseHeaderLine


SFXMailUtility::IsWSP
Check whether or not the specified character is a white space(a space character or a tab character).
[ 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

This function checks whether or not the specified character is a white space(space["0x20"] or tab["0x09"]).

Reference

SFXMailUtility::SkipWSP | SFXMailUtility::IsAtext | SFXMailUtility::IsCTL | SFXMailUtility::IsTokenChar | SFXMailUtility::IsTspecials | RFC2822: 2.2.2. Structured Header Field Bodies


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

  • If succeeds: SFERR_NO_ERROR
  • If there are some characters that cannot be converted: SFERR_INVALID_FORMAT
  • If the out argument is null: 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 "unconvChar" argument and the return value will be SFERR_NO_ERROR.

Description

The half-width kana is supported.

Reference

SFXMailUtility::ShiftJISToJIS | RFC1468: Japanese Character Encoding for Internet Messages


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

Return value

  • If succeeds: 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 the 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

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

Description

This function parses the specified string and get the parsed mail address, which is defined in RFC2822: 3.4.1. Addr-spec specification.

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::ParseDotAtom | SFXMailUtility::SkipWSP | RFC2822: 3.4.1. Addr-spec specification


SFXMailUtility::ParseAtom
Get the 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

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

Description

This function parses the specified string and get the parsed atom, which is defined in RFC2822: 3.2.4. Atom.

Reference

SFXMailUtility::ParseDotAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::SkipWSP | SFXMailUtility::IsAtext | RFC2822: 3.2.4. Atom


SFXMailUtility::ParseContentType
Get the 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

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

Description

This function parses the specified string and get the parsed data of the Content-Type field, which is defined in RFC2045: 5. Content-Type Header Field.

Reference

SFXMailUtility::ParseParameterList | SFXMailUtility::ParseParameter | SFXMailUtility::ParseToken | SFXMailUtility::SkipWSP | RFC2045: 5. Content-Type Header Field


SFXMailUtility::ParseDate
Get the 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

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

Description

This function parses the specified string and get the parsed date, which is defined in RFC2822: 3.3. Date and Time Specification.

Reference

SFXDate::Parse | SFXMailUtility::SkipWSP | SFXDate | RFC2822: 3.3. Date and Time Specification


SFXMailUtility::ParseDotAtom
Get the 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

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

Description

This function parses the specified string and get the parsed dot-atom, which is defined in RFC2822: 3.2.4. Atom.

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.

This function skips the biginning white space characters of the specified string.

Reference

SFXMailUtility::ParseAtom | SFXMailUtility::ParseDotAtomText | SFXMailUtility::IsAtext | RFC2822: 3.2.4. Atom


SFXMailUtility::ParseDotAtomText
Get the 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

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

Description

This function parses the specified string and get the parsed dot-atom-text, which is defined in RFC2822: 3.2.4. Atom.

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 .

This function does not skip the biginning white space characters of the specified string.

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

Reference

SFXMailUtility::ParseAtom | SFXMailUtility::ParseDate | SFXMailUtility::ParseDotAtom | SFXMailUtility::IsAtext | RFC2822: 3.2.4. Atom


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

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

Description

This 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).

Reference

SFXMailUtility::SkipWSP | SFXMailUtility::IsValidFieldName | SFXMailUtility::IsWSP | RFC2822: 2.2. Header Fields


SFXMailUtility::ParseMailbox
Get the 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

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

Description

This function parses the specified string and get the parsed mail address(mailbox), which is defined in RFC2822: 3.4.1. Addr-spec specification.

This function can parse the "addr-spec" format of (1) and (2), and the "name-addr" format of (3).

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::ParseMailboxList | SFXMailUtility::ParseAddrSpec | SFXMailUtility::ParsePhrase | SFXMailUtility::SkipWSP | RFC2822: 3.4.1. Addr-spec specification


SFXMailUtility::ParseMailboxList
Get the 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

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

Description

This function parses the specified string and get the parsed list of mail addresses (mailbox), which is defined in RFC2822: 3.4.1. Addr-spec specification.

Reference

SFXMailUtility::ParseMailbox | SFXMailUtility::SkipWSP | RFC2822: 3.4.1. Addr-spec specification


SFXMailUtility::ParseParameter
Get the 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

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

Description

This function parses the specified string and get the parameter like "attribute = value", which is defined in RFC2045: 5. Content-Type Header Field.

This function can parse only one parameter.

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

Reference

SFXMailUtility::ParseParameterList | SFXMailUtility::ParseQuotedString | SFXMailUtility::ParseToken | SFXMailUtility::SkipWSP | RFC2045: 5. Content-Type Header Field


SFXMailUtility::ParseParameterList
Get the specified string as list of parameters.
[ public, static ]
SFCError ParseParameterList(
    ACharConstPtr start        // pointer to the head of string to be parsed
    ACharConstPtr end          // pointer to the end of string to be parsed
    SFXPropertyPtr paramList   // pointer to the parsing result: list of parameters
);

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.

paramList

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

Return value

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

Description

This function parses the specified string and get the list of parameters like "attr1 = value1; attr2 = value2; ... ", which is defined in RFC2045: 5. Content-Type Header Field.

Reference

SFXMailUtility::ParseParameter | SFXMailUtility::SkipWSP | RFC2045: 5. Content-Type Header Field


SFXMailUtility::ParsePhrase
Get the specified string as phrase.
[ public, static ]
SFCError ParsePhrase(
    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: phrase
);

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 phrase. Specify null if unnecessary.

value

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

Return value

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

Description

This function parses the specified string and get the parsed phrase, which is defined in RFC2822: 3.2.6. Miscellaneous tokens. A phrase consists of one or more words.

This function returns the unquoted string in which each word is tied with a white space character.

Reference

SFXMailUtility::ParseMailbox | SFXMailUtility::ParseWord | SFXMailUtility::SkipWSP | RFC2822: 3.2.6. Miscellaneous tokens


SFXMailUtility::ParseQuotedString
Get the specified string as quoted-string.
[ public, static ]
SFCError ParseQuotedString(
    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: quoted-string
);

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 quoted-string. Specify null if unnecessary.

value

Specify a pointer to the variable to store the parsed quoted-string. Specify null if unnecessary.

Return value

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

Description

This function parses the specified string and get the parsed quoted-string, which is defined in RFC2822: 3.2.5. Quoted strings.

Reference

SFXMailUtility::SkipWSP | RFC2822: 3.2.5. Quoted strings


SFXMailUtility::ParseToken
Get the specified string as token.
[ public, static ]
SFCError ParseToken(
    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: token
);

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 token. Specify null if unnecessary.

value

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

Return value

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

Description

This function parses the specified string and get the parsed token, which is defined in RFC2045: Appendix A -- Collected Grammar.

Reference

SFXMailUtility::IsTokenChar | SFXMailUtility::ParseContentType | SFXMailUtility::SkipWSP | RFC2045: Appendix A -- Collected Grammar


SFXMailUtility::ParseWord
Get the specified string as word.
[ public, static ]
SFCError ParseWord(
    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: word
);

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 word. Specify null if unnecessary.

value

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

Return value

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

Description

This function parses the specified string and get the parsed word, which is defined in RFC2822: 3.2.6. Miscellaneous tokens.

Reference

SFXMailUtility::ParseAtom | SFXMailUtility::ParseQuotedString | SFXMailUtility::SkipWSP | RFC2822: 3.2.6. Miscellaneous tokens


SFXMailUtility::ShiftJISToJIS
Convert the specified string in Shift_JIS code into JIS code (iso-2022-jp).
[ public, static ]
SFCError ShiftJISToJIS(
    SFXAnsiStringConstRef in   // reference to the source 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 Shift_JIS code.

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

  • If succeeds: SFERR_NO_ERROR
  • If there is some characters that cannot be converted: SFERR_INVALID_FORMAT
  • If the out argument is null: 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 "unconvChar" argument and the return value will be SFERR_NO_ERROR.

Reference

SFXMailUtility::JISToShiftJIS


SFXMailUtility::SkipUntilCRLF
Get the position of the next CRLF or '\0' chararacter.
[ public, static ]
Void SkipUntilCRLF(
    ACharConstHandle start   // handle that stores a pointer to the starting position to search for the next CRLF or '\0' chararacter and to the result position
);

Description

This function searches for the next CRLF or '\0' from the character position that the "start" argument points to, and return its character position via the "start" argument.

The return value of the "start" argument points to the character next after LF or the '\0' character.


SFXMailUtility::SkipWSP
Advance the pointer to the first character other than WSP(space or horizontal tab) or the ending position specified.
[ public, static ]
Void SkipWSP(
    ACharConstHandle start   // [in]starting position;[out] the positon of the character other than WSP or the ending position specified
    ACharConstPtr end        // ending position
);

Description

This function advances the pointer to the first character other than WSP(space or horizontal tab) or the ending position specified.

Reference

SFXMailUtility::IsWSP


SFXMailUtility::Mailbox
Structure that represents a mail address.
struct Mailbox {
    SFXAnsiString   name;  // display name
    SFXAnsiString   addr;  // addr-spec
};

Description

The "name" field represents the display name of a mail, and the "addr" field represents the addr-spec of a mail.

The data of the SFXMailUtility::Mailbox structure is obtained by the SFXMailUtility::ParseMailbox and SFXMailUtility::ParseMailboxList functions.

Reference

SFXMailUtility::ParseMailbox | SFXMailUtility::ParseMailboxList