SophiaFramework UNIVERSE 5.3 |
Class to process the mail message that is defined in RFC2822 (Internet Message Format). With this class you can create, change, write, and parse mail messages. Multi-part message and attached file can also be processed.
Encoding of the Subject field and the file name of attached data | |
---|---|
RFC2231(MIME Parameter Value and Encoded Word Extensions) is not supported. |
Procedure to send a SMTP mail.
Example 824. Create a mail message
class MyClass { private: SFXSMTPSender _sender; XALLBACK_DECLARE_SFXSMTPSENDER(SMTPCallback) public: Void Start(Void); }; Void MyClass::Start(Void) { SFCError error; SFXMailMessage message; // set Subject field to mail header message.SetSubjectField("Mail Subject"); // set From field to mail header message.SetFromField("fromaddress@example.com"); // add To address to mail header message.AddToField("toaddress1@example.com"); message.AddToField("toaddress2@example.com"); // add Cc address to mail header message.AddCcField("toaddress3@example.com"); // add Bcc address to mail header message.AddBccField("toaddress4@example.com"); // add Content Type to mail header message.AddField("Content-Type", "text"); // set Body of mail message message.SetBody("Mail test\r\nThis mail is sent by SFXSMTPSender.\r\n"); // create file name to attach SFXBuffer buff("Hello", 5); attach file to the mail message message.AttachFile(buff, "filename.txt", "text", "plain"); // specify IP address and port number of SMTP server (domain is automatically resolved) _sender.SetServer(SFXSocketAddress("smtpserver.example.com:25")); // register SMTPCallback as callback function, and then send mail // SMTPCallback function will be notified of the completion of sending mail if ((error = _sender.SendMessage(&message, XALLBACK_INTERNAL(SMTPCallback))) != SFERR_NO_ERROR) { // callback will never be notifiled to SMTPCallback function if error is not SFERR_NO_ERROR // error handling for this case } } // callback function notified of the completion of sending mail XALLBACK_IMPLEMENT_SFXSMTPSENDER(MyClass, SMTPCallback, error) { if (error == SFERR_NO_ERROR) { TRACE("Mail has been sent."); } else { TRACE("Mail sending failed. %d", error); } }
Procedure to receive a POP3 mail
Processing of a multi-part message | |
---|---|
To process a multi-part message, use the SFXMailMessage::IsMultipart function. |
Example 825. Parse the received mail message
// received mail message SFXAnsiString receivedString = "From: Albert Einstein <einstein@example.com>\r\n" "To: Isaac Newton <newton@example.com>\r\n" "Subject: untitled\r\n" "Date: Sat, 08 Mar 2008 20:37:58 +0900\r\n" "\r\n" "This is a mail body.\r\n"; SFXMailMessage message; // parse mail message message.Parse(receivedString); // get From field from mail header // fromString: "Albert Einstein <einstein@example.com>" SFXAnsiString fromString = message.GetFromField(); // get To field from mail header // toString: "Isaac Newton <newton@example.com>" SFXAnsiString toString = message.GetToField(); // get Subject field from mail header // subjectString: "untitled" SFXAnsiString subjectString = message.GetSubjectField(); // get Date field from mail header as SFXDate instance // date: "Sat, 08 Mar 2008 20:37:58 +0900" SFXDate date = message.GetDateField(); // get Body // bodyString: "This is a mail body.\r\n" SFXAnsiString bodyString = message.GetBody();
Constructor/Destructor |
---|
SFXMailMessage( Void ) Constructor of the SFXMailMessage class.
|
~SFXMailMessage( Void ) Destructor of the SFXMailMessage class.
|
Public Functions | |
---|---|
SFCError |
AddBccField(
SFXAnsiStringConstRef bcc
) Add the "bcc:" mail address to the Bcc field of the mail header.
|
SFCError |
AddCcField(
SFXAnsiStringConstRef cc
) Add the "cc:" mail address to the Cc field of the mail header.
|
SFCError |
AddField(
SFXAnsiStringConstRef name
, SFXAnsiStringConstRef value
) Add a value to a field of the mail header.
|
SFCError |
AddMultipartBody(
SFXMailMessagePtr body
) Add a message to the multi-part message.
|
SFCError |
AddToField(
SFXAnsiStringConstRef to
) Add the "to:" mail address to the To field of the mail header.
|
SFCError |
AttachFile(
SFXBufferConstRef file
, SFXAnsiStringConstRef fileName
, SFXAnsiStringConstRef mainType = "application"
, SFXAnsiStringConstRef subType = "octet-stream"
) Attach a file to the mail message.
|
Void |
Clear( Void ) Clear the content of this mail message.
|
SFCError |
GetAttachedFile(
SInt32 index
, SFXBufferPtr data
, SFXAnsiStringPtr fileName
, SFXAnsiStringPtr mainType = null
, SFXAnsiStringPtr subType = null
) Get the attached file of this mail message.
|
SFXAnsiString |
GetBccField(
Bool isDecoding = true
) Get the value of the Bcc field of this mail message.
|
SFXAnsiString |
GetBody(
Bool isDecoding = true
) Get the body of this mail message.
|
SFXAnsiStringConstRef |
GetBodyRef( Void ) Get the body reference of this mail message.
|
SFXAnsiString |
GetBodyText(
Bool isDecoding = true
) Get the body of this mail message.
|
SFXAnsiString |
GetCcField(
Bool isDecoding = true
) Get the value of the Cc field of this mail message.
|
SFXAnsiString |
GetContentType( Void ) Get the value of Content-Type of this mail message.
|
SFCError |
GetContentType(
SFXAnsiStringPtr mainType
, SFXAnsiStringPtr subType
, SFXPropertyConstHandle attribute
) Get the value of Content-Type of this mail message.
|
SFXDate |
GetDateField( Void ) Get the value of the Date field of the mail header of this mail message.
|
SFXAnsiString |
GetEpilogue(
Bool isDecoding = true
) Get the Epilogue (suffix part) of the multi-part message.
|
SFXAnsiString |
GetField(
SFXAnsiStringConstRef name
, Bool isDecoding = true
, BoolPtr found = null
) Get the value of the specified field of the mail header of this mail message.
|
SFXPropertyConstRef |
GetFieldList( Void ) Get all the header fields of this mail message.
|
SFXAnsiString |
GetFromField(
Bool isDecoding = true
) Get the value of the From field of this mail message.
|
SFXMailMessagePtr |
GetMultipartMessage(
SInt32 index
) Get the specified internal message in the multi-part message.
|
UInt32 |
GetMultipartSize( Void ) Get the number of internal messages in the multi-part message.
|
SFXAnsiString |
GetPreamble(
Bool isDecoding = true
) Get the Preamble(prefix part) of the multi-part message.
|
SFXAnsiString |
GetSubjectField(
Bool isDecoding = true
) Get the value of the Subject field of the mail header of this mail message.
|
SFXAnsiString |
GetToField(
Bool isDecoding = true
) Get the value of the To field of the mail header of this mail message.
|
Bool |
HasField(
SFXAnsiStringConstRef name
) Check whether or not the mail header has the specified field.
|
Bool |
IsMultipart( Void ) Check whether or not this is a multi-part message.
|
SFCError |
Parse(
ACharConstPtr message
) Parse the specified text and read it as a mail message.
|
SFCError |
Parse(
SFXAnsiStringConstRef message
) Parse the specified text and read it as a mail message.
|
SFCError |
Parse(
ACharConstPtr start
, ACharConstPtr end
) Parse the specified text and read it as a mail message.
|
SFCError |
ParseHeaderOnly(
ACharConstPtr message
) Parse the specified text, and only the header is read as a mail message.
|
SFCError |
ParseHeaderOnly(
SFXAnsiStringConstRef message
) Parse the specified text, and only the header is read as a mail message.
|
SFCError |
ParseHeaderOnly(
ACharConstPtr start
, ACharConstPtr end
) Parse the specified text, and only the header is read as a mail message.
|
Void |
RemoveField(
SFXAnsiStringConstRef name
) Remove the specified field from the mail header.
|
SFCError |
ReplaceBccField(
SFXAnsiStringConstRef bcc
) Replace the Bcc field of the mail header with a specifdied "bcc:" mail address.
|
SFCError |
ReplaceCcField(
SFXAnsiStringConstRef cc
) Replace the Cc field of the mail header with a specifdied "cc:" mail address.
|
SFCError |
ReplaceField(
SFXAnsiStringConstRef name
, SFXAnsiStringConstRef value
) Replace the value of the specified field of the mail header with the specified value.
|
SFCError |
ReplaceToField(
SFXAnsiStringConstRef to
) Replace the To field in the mail header with a specifdied "to:" mail address.
|
SFCError |
SetBody(
SFXAnsiStringConstRef text
) Set the body of this mail message.
|
SFCError |
SetContentType(
SFXAnsiStringConstRef mainType
, SFXAnsiStringConstRef subType
) Set the Content-Type of this mail message.
|
SFCError |
SetContentType(
SFXAnsiStringConstRef mainType
, SFXAnsiStringConstRef subType
, SFXPropertyConstRef attribute
) Set the Content-Type of this mail message.
|
SFCError |
SetEpilogue(
SFXAnsiStringConstRef text
) Set the specified text to the Epilogue(suffix part) of the multi-part message.
|
SFCError |
SetFromField(
SFXAnsiStringConstRef from
) Set the specified "from" mail address to the From field of the mail header.
|
SFCError |
SetPreamble(
SFXAnsiStringConstRef text
) Set the specified text to the Preamble(prefix part) of this mail message.
|
SFCError |
SetSubjectField(
SFXAnsiStringConstRef subject
) Set the specified "subject" text to the Subject field of the mail header.
|
SFXAnsiString |
Write(
Bool isEncoding = true
, UInt32 fieldMaxLen = 78
) Write the mail message as a text.
|
Types |
---|
DocList Prototype that represents an array of mail messages.
|
[ public, explicit ] SFXMailMessage(Void);
This constructor does nothing.
[ public ] ~SFXMailMessage(Void);
This destructor calls the SFXMailMessage::Clear function to clear the contents of this mail message.
[ public ] SFCError AddBccField( SFXAnsiStringConstRef bcc // "bcc:" mail address );
Specify the "bcc:" mail address.
[ public ] SFCError AddCcField( SFXAnsiStringConstRef cc // "cc:" mail address );
Specify the "cc:" mail address.
[ public ] SFCError AddField( SFXAnsiStringConstRef name // name of the field SFXAnsiStringConstRef value // value of the field );
Specify a valid string for the field name of the mail header.
Specify the value of field.
Different from the SFXMailMessage::ReplaceField function, the SFXMailMessage::AddField function adds the value without deleting the existing values of the field.
For the fields such as From, To, etc. that can not have more than one value, use the SFXMailMessage::ReplaceField function to replace the existing value. For the fields such as Received that can have more than one value, use the SFXMailMessage::AddField function to add the value.
SFXMailMessage::ReplaceField | SFXMailMessage::HasField | SFXMailMessage::RemoveField | SFXMailMessage::GetField | SFXMailMessage::GetFieldList
[ public ] SFCError AddMultipartBody( SFXMailMessagePtr body // message to be added );
Specify the message to be added.
Set "multipart" to the Content-Type using SFXMailMessage::SetContentType function before calling the SFXMailMessage::AddMultipartBody function.
[ public ] SFCError AddToField( SFXAnsiStringConstRef to // "to:" mail address );
Specify the "to:" mail address.
[ public ] SFCError AttachFile( SFXBufferConstRef file // attached data SFXAnsiStringConstRef fileName // name of attached file SFXAnsiStringConstRef mainType = "application" // Content-Type of attached data SFXAnsiStringConstRef subType = "octet-stream" // Content-Sub-Type of attached data );
Specify the data to be attached. (Any data can be attached.)
Specify the file name to be attached.
Note | |
---|---|
If "null" is specified, data will be not attached but inlined. |
Specify the Content-Type of data to be attached.
Specify "text" if text and "image" if image.
Note | |
---|---|
If this argument is not specified, "application" is set by default. |
Specify the Content-Sub-Type of data to be attached.
In case of the Jpeg image, "image" and "jpeg" need to be set to the "mainType" and "subType" arguments respectively.
Note | |
---|---|
If this argument is not specified, "octet-stream" is set by default. |
The mail body should be set by the SFXMailMessage::SetBody before the SFXMailMessage::AttachFile function is called. At the time when the SFXMailMessage::AttatchFile function is called, the mail message comes to have the multi-part part even if the original message has no multi-part.
Attached data will be automatically encoded in the Base64 format.
The internal procedure to attach a file to the mail message is as follows:
Attach a text file.
// attach to SFXMailMessage msg msg.SetBody("Message Body"); // set Body before attaching file SFXBuffer buff1("abc", 3); // text file to be attached (file 1) SFXBuffer buff2("defghij", 7); // text file to be attached (file 2) msg.AttachFile(buff1, "filename1.txt", "text", "plain"); msg.AttachFile(buff2, "filename2.txt", "text", "plain");
[ public ] Void Clear(Void);
[ public, const ] SFCError GetAttachedFile( SInt32 index // file number SFXBufferPtr data // attached data SFXAnsiStringPtr fileName // name of attached file SFXAnsiStringPtr mainType = null // Content-Type of attached data SFXAnsiStringPtr subType = null // Content-Sub-Type of attached data );
Specify the index of the file to be taken.
The number of attached files can be obtained by the SFXMailMessage::GetMultipartSize function. The "index" number starts from 0.
Specify the destination to store the attached data. If not necessary, specify "null".
Specify the destination to store the file name of attached data. If not necessary, specify "null".
Specify the destination to store the Content-Type of attached data. If not necessary, specify "null".
Specify the destination to store the Content-Sub-Type of attached data. If not necessary, specify "null".
The file encoded in the Base64 format is automaticaly decoded.
Encoding of the file name of attached data | |
---|---|
RFC2231(MIME Parameter Value and Encoded Word Extensions) is not supported. |
SFXMailMessage::AttachFile | SFXMailMessage::AddMultipartBody | SFXMailMessage::IsMultipart | SFXMailMessage::GetMultipartSize
[ public, const ] SFXAnsiString GetBccField( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Q or B format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the value of Bcc field.
[ public, const ] SFXAnsiString GetBody( Bool isDecoding = true // decode or not? );
Specify whether or not to decode.
If true: This mail message encoded in the Quoted-Printable or Base64 format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the body of the mail message.
Return null in case of the multi-part message.
To get the body of multi-part message, use the SFXMailMessage::GetMultipartMessage function.
SFXMailMessage::SetBody | SFXMailMessage::GetMultipartMessage | SFXMailMessage::GetBodyText
[ public, const ] SFXAnsiStringConstRef GetBodyRef(Void);
Return the reference to the body of this mail message.
Return a reference to the "null" string in case of the multi-part message.
To deal with the body of this mail message efficiently, use the SFXMailMessage::GetBodyRef function.
[ public, const ] SFXAnsiString GetBodyText( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Quoted-Printable or Base64 format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the body of this mail message.
In case of the multi-part message, the first text of the multi-part part is returned.
[ public, const ] SFXAnsiString GetCcField( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Q or B format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the value of Cc field.
[ public, const ] SFXAnsiString GetContentType(Void);
[ public, const ] SFCError GetContentType( SFXAnsiStringPtr mainType // Content-Type SFXAnsiStringPtr subType // Content-Sub-Type SFXPropertyConstHandle attribute // attribute );
[ public, const ] SFXDate GetDateField(Void);
Return the value of the Date field(SFXDate).
[ public, const ] SFXAnsiString GetEpilogue( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Quoted-Printable or Base64 format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the Epilogue (suffix part) of the multi-part message.
Return null if there is no Epilogue (suffix part) in the multi-part message.
Epilogue (suffix part) is a string added at the end of the multi-part message defined in RFC2046 (MIME Part Two : Media Types Text).
SFXMailMessage::SetEpilogue | SFXMailMessage::GetPreamble | SFXMailMessage::SetPreamble | SFXMailMessage::IsMultipart
[ public, const ] SFXAnsiString GetField( SFXAnsiStringConstRef name // field name Bool isDecoding = true // whether or not to decode BoolPtr found = null // whether the field exists or not );
Specify a valid string for the field name of the mail header.
Specify whether or not to decode.
If true: This mail message encoded in the Quoted-Printable or Base64 format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Specify a pointer to the variable, where "true" will be returned if the specified field exists. Specify null if unnecessary.
Return the value of the specified field.
If more than one value are stored with the same field name, only the first value is read.
To get all the values stored with the same field name, use the SFXMailMessage::GetFieldList function.
SFXMailMessage::AddField | SFXMailMessage::ReplaceField | SFXMailMessage::HasField | SFXMailMessage::RemoveField | SFXMailMessage::GetFieldList
[ public, const ] SFXPropertyConstRef GetFieldList(Void);
Return all the header fields of this mail message as the instance of the SFXProperty class.
Please edit the header of this mail message carefully! | |
---|---|
The validity of the field names will not be checked when editing the header of this mail message using the SFXProperty instance obtained by the SFXMailMessage::GetFieldList function. Therefore, you need to note the following items.
|
SFXMailMessage::AddField | SFXMailMessage::ReplaceField | SFXMailMessage::RemoveField | SFXMailMessage::HasField | SFXMailMessage::RemoveField | SFXMailMessage::GetField | SFXProperty
[ public, const ] SFXAnsiString GetFromField( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Q or B format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return From field value.
[ public ] SFXMailMessagePtr GetMultipartMessage( SInt32 index // internal message index );
Return a pointer to the internal message in the multi-part message(SFXMailMessage instance).
The multi-part message has multiple of internal messages as the SFXMailMessage instances.
The pointer to any internal message can be obtained by specifying its "index" number(The "index" number starts from 0).
If the mail message is not a multi-part message, or the "index" number is out of range, "null" is returned.
Get the internal messages in the multi-part message one by one.
// "msg" has mail message SInt32 i; SFXMailMessage msg; SFXMailMessagePtr mail; if (msg.IsMultipart()) { //check whether or not the mail message is multi-part for (i = 0; i < msg.GetMultipartSize(); i++) { mail = msg.GetMultipartMessage(i); // process mail ... } }
SFXMailMessage::IsMultipart | SFXMailMessage::AddMultipartBody | SFXMailMessage::GetMultipartMessage
[ public, const ] UInt32 GetMultipartSize(Void);
Return the number of internal messages in the multi-part message.
Return 0 if the message has no multi-part.
[ public, const ] SFXAnsiString GetPreamble( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Quoted-Printable or Base64 format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the Preamble (prefix part) of the multi-part message.
Return null if there is no Preamble (prefix part) in the multi-part message.
The Preamble(prefix part) is a string added at the beginning of the multi-part message defined in RFC2046 ( MIME Part Two : Media Types Text ).
The string such as "This is a MIME multipart message." is set.
SFXMailMessage::SetPreamble | SFXMailMessage::GetEpilogue | SFXMailMessage::SetEpilogue | SFXMailMessage::IsMultipart
[ public, const ] SFXAnsiString GetSubjectField( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Q or B format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the value of Subject field.
Encoding of the Subject field | |
---|---|
RFC2231(MIME Parameter Value and Encoded Word Extensions) is not supported. |
[ public, const ] SFXAnsiString GetToField( Bool isDecoding = true // whether or not to decode );
Specify whether or not to decode.
If true: This mail message encoded in the Q or B format will be decoded. This mail message in Japanese will be converted into the Shift-JIS code.
Default: true.
Return the value of the To field.
[ public, const ] Bool HasField( SFXAnsiStringConstRef name // field name );
Specify a valid string for the field name of the mail header.
SFXMailMessage::AddField | SFXMailMessage::ReplaceField | SFXMailMessage::RemoveField | SFXMailMessage::GetField | SFXMailMessage::GetFieldList
[ public, const ] Bool IsMultipart(Void);
If the mainType of the Content-Type is "multipart", it is a multi-part message.
[ public ] SFCError Parse( ACharConstPtr message // text to be parsed );
[ public ] SFCError Parse( SFXAnsiStringConstRef message // text to be parsed );
[ public ] SFCError Parse( ACharConstPtr start // pointer to the beginning of text to be parsed ACharConstPtr end // pointer to the end of text to be parsed );
Text to be parsed as mail message.
Pointer to the beginnig of text to be parsed as mail message.
Pointer to the end of text to be parsed as mail message.
This function can be used for the multi-part message.
[ public ] SFCError ParseHeaderOnly( ACharConstPtr message // text to be parsed );
[ public ] SFCError ParseHeaderOnly( SFXAnsiStringConstRef message // text to be parsed );
[ public ] SFCError ParseHeaderOnly( ACharConstPtr start // pointer to the beginning of the text to be parsed ACharConstPtr end // pointer to the end of the text to be parsed );
Text to be parsed as mail message.
Pointer to the beginning of the text to be parsed as mail message.
Pointer to the end of the text to be parsed as mail message.
[ public ] Void RemoveField( SFXAnsiStringConstRef name // name of field to be delete );
The SFXMailMessage::RemoveField function does nothing if the specified field does not exist.
SFXMailMessage::ReplaceToField | SFXMailMessage::ReplaceCcField | SFXMailMessage::ReplaceBccField | SFXMailMessage::AddField | SFXMailMessage::HasField | SFXMailMessage::RemoveField | SFXMailMessage::GetField | SFXMailMessage::GetFieldList
[ public ] SFCError ReplaceBccField( SFXAnsiStringConstRef bcc // "bcc:" mail address );
Specify the value of Bcc field to replace with.
[ public ] SFCError ReplaceCcField( SFXAnsiStringConstRef cc // "cc:" mail address );
Specify the value of Cc field to replace with.
[ public ] SFCError ReplaceField( SFXAnsiStringConstRef name // field name SFXAnsiStringConstRef value // value of field to replace with );
Specify a valid string for the field name of the mail header.
Specify replaced data.
If the specified field does not exist, it will be created with the specified value.
If the number of fields with the specified name is one, its value will be replaced with the specified value.
If the number of fields with the specified name is more than one, only the value of first field will be replaced with the specified value.
SFXMailMessage::AddField | SFXMailMessage::HasField | SFXMailMessage::RemoveField | SFXMailMessage::GetField | SFXMailMessage::GetFieldList
[ public ] SFCError ReplaceToField( SFXAnsiStringConstRef to // "to:" mail address );
Specify the value of To field to replace with.
[ public ] SFCError SetBody( SFXAnsiStringConstRef text // body of the mail message );
Body of the mail message.
Multi-part message | |
---|---|
This function fails in case of the multi-part message. To add the Body to the multi-part message, create a instance of the SFXMailMessage class, set the Body to this instance, and add this instance to the multi-part message using the SFXMailMessage::AddMultipartBody function. |
[ public ] SFCError SetContentType( SFXAnsiStringConstRef mainType // main type SFXAnsiStringConstRef subType // subtype );
[ public ] SFCError SetContentType( SFXAnsiStringConstRef mainType // Content-Type SFXAnsiStringConstRef subType // Content-Sub-Type SFXPropertyConstRef attribute // attribute );
If mainType is "multipart", the mail message is processed as a multi-part message.
[ public ] SFCError SetEpilogue( SFXAnsiStringConstRef text // Epilogue(suffix part) );
Epilogue(suffix part) is a string added at the end of the multi-part message defined in RFC2046 (MIME Part Two : Media Types Text).
This setting is invalid if the message has no multi-part.
[ public ] SFCError SetFromField( SFXAnsiStringConstRef from // "from" mail address );
Specify the value of From field.
[ public ] SFCError SetPreamble( SFXAnsiStringConstRef text // Preamble(prefix part) );
Preamble (prefix part) is a string added at the beginning of the multi-part message defined in RFC2046 (MIME Part Two : Media Types Text).
A string such as "This is a MIME multi-part message." is set.
This setting is invalid if the message has no multi-part.
[ public ] SFCError SetSubjectField( SFXAnsiStringConstRef subject // "subject" text );
Specify the value of Subject field.
[ public ] SFXAnsiString Write( Bool isEncoding = true // whether or not to encode UInt32 fieldMaxLen = 78 // loopback digits of header );
Specify whether or not to encode.
If true: the header encoded in Shift-JIS code will be encoded in Base64 and written. The body of the mail message is encoded in the JIS code(ISO-2022-JP).
Default: true.
Specify the loopback digits(excluding CR and LF) of the header.
The characters in the header line at greater digit than the fieldMaxLen argument is automatically turned back. The value of the fieldMaxLen argument needs to be specified between 4 and 998.
Return the mail message as text.
The mail message is written as a text. If "true" is set to the isEncode argument, it is automatically converted into a appropriate character-code for sending mail.
Encoding of the Subject field and the file name of attached data | |
---|---|
RFC2231(MIME Parameter Value and Encoded Word Extensions) is not supported. |
typedef SFXArray<SFXMailMessagePtr> DocList
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |