4D Internet Commands v16

SMTP_SetPrefs

Home

 
4D Internet Commands v16
SMTP_SetPrefs

SMTP_SetPrefs 


 

SMTP_SetPrefs ( lineFeed ; charset&Encoding ; lineLength ) -> Function result 
Parameter Type   Description
lineFeed  Integer in 1 = [default] Add, 0 = Don't Add, -1 = No Change
charset&Encoding  Longint in Charset of the message body, headers and attachment filenames as well as encoding of the body (-1 = No Change)
lineLength  Longint in Maximum line length (0 = [default] Auto-detect, -1 = No Change)
Function result  Integer in Error Code

The SMTP_SetPrefs command sets the preferences of messages to be sent using the SMTP commands. The command has a global scope and will affect all subsequent messages created with the SMTP commands. The configurable options affect the format of a mail message as it is sent to a SMTP server using the SMTP_QuickSend or SMTP_Send commands. The preference settings have an interprocess scope and effect mail creation in any 4D process.

SMTP servers recognize the end of a line to be a combined carriage return/line feed (CR/LF) character pair. This differs from most Mac applications, which view a single carriage return as the end of line/paragraph marker.

lineFeed is an integer value which specifies how to handle carriage returns within the body of a mail message. Passing a value of zero in this parameter will leave the message body text untouched, permitting the developer to control their own line feed additions. A value of 1 (default setting) will replace all carriage return/line feed pairings with carriage returns for you. A value of -1 will leave the current value of the preference unchanged. If you are unsure which option to choose, you should choose 1, the default value.

charset&Encoding specifies the charset used in the message body, headers and attachment filenames to be sent as well as the encoding to apply to the message body, according to the values in the table below. For example, “US-ASCII & 7 bit” (value 2) means that the message body charset currently in use is supposed to be US ASCII — includes only standard ASCII codes (0 through 127) which are common to Windows and Mac— and that 4D Internet Commands will encode the message body using the 7 bit encoding. Note that the SMTP_SetPrefs command does NOT convert the message body using the specified charset, this has to be managed by the user if necessary. If you want to force the charset conversion, refer to the SMTP_Charset command description.
If not changed, the default content type is 1.

ValueBody charset & encodingHeaders and attachment filenames charset (encoding always base64)
-1No changeNo change
0Application & binary; no encodingISO-8859-1
1Default: UTF-8 & base64Default: UTF-8 for subject, ISO-8859-1 for other fields
2US-ASCII & 7bitISO-8859-1
3US-ASCII & quotable-printableISO-8859-1
4US-ASCII & base64ISO-8859-1
5ISO-8859-1 & quotable-printableISO-8859-1
6ISO-8859-1 & base64ISO-8859-1
7ISO-8859-1 & 8bitISO-8859-1
8ISO-8859-1 & binaryISO-8859-1
9ReservedReserved
10ISO-2022-JP (Japanese) & 7 bitISO-2022-JP
11ISO-2022-KR (Korean) & 7 bitISO-2022-KR
12ISO-2022-CN (Traditional & Simplified Chinese) & 7 bitISO-2022-CN
13HZ-GB-2312 (Simplified Chinese) & 7 bitHZ-GB-2312
14Shift-JIS (Japanese) & base64Shift-JIS
15UTF-8 & quoted-printableUTF-8
16UTF-8 & base64UTF-8

Note: We recommend using default settings, which are appropriate for most current systems/applications.

Warning: The € ("euro") character is not part of ISO-8859-1.

lineLength specifies a maximum SMTP line length for text within the message body. The SMTP commands will "line wrap" the body text by inserting a carriage return/line feed pair before the maximum line length when the text is encoded. Any number may be specified but RFC 2822 requires that line length does not exceed 998 and recommends a maximum of 78. A value of -1 will leave the current value unchanged.

The lineLength parameter defaults to zero. A value of zero will cause the SMTP commands to use the recommended values specified within the RFC definitions for the charset&encoding. If the lineLength parameter is set to zero, wrapping will occur based on the following table:

Body TypeWrap at
Base6476
Quoted-Printable76
Other…no wrapping

Line wrapping is strongly suggested since many systems and mail programs have problems handling messages containing unlimited line lengths. Also, keep in mind that mail often travels through a number of systems before reaching its final destination and any computer along the delivery path may reject a message if it is unable to handle the message's format.

Example  

The following code sends a message with body in UTF-8 encoded in quotedprintable (headers remain in default charset):

 $err:=SMTP_SetPrefs(-1;15;-1)
 $err:=SMTP_Charset(0;1) //apply preferences
 $err:=SMTP_QuickSend("mymail.com";"myaddress";"destination";"the Euro €";"the Euro symbol is €")



See also 

SMTP_Charset
SMTP_GetPrefs

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC Send Mail
Number: 88994

 
HISTORY 

Modified: 4D Internet Commands v11.2
Modified: 4D v16

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v16)