4D v13.2

SMTP_SetPrefs

Home

 
4D v13.2
SMTP_SetPrefs

SMTP_SetPrefs 


 

SMTP_SetPrefs ( lineFeed ; bodyType ; lineLength ) -> Function result 
Parameter Type   Description
lineFeed  Integer in 1 = [default] Add, 0 = Don't Add, -1 = No Change
bodyType  Integer in Body-Content-Type (1 = [default] Auto-detect, -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 Macintosh applications, which view a single carriage return as the end of line/paragraph marker.

lineFeeds 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.

bodyType specifies the character set used in the message body to be sent (Body-Content-Type) as well as the encoding to apply to the message body (Content-Transfer-Encoding), 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 Macintosh— and that 4D IC 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 character set, this has to be managed by the user if necessary. If you want to force the character set conversion, refer to the SMTP_Charset command description.
If not changed, the default content type is 1, which will allow the SMTP commands to auto-detect an appropriate setting based on the contents of the message body.

-1No change
0Application & binary; no encoding
1Default; will choose either "US-ASCII & 7bit" or "ISO-8859-1 & quotable-printable" based on message content.
2US-ASCII & 7bit
3US-ASCII & quotable-printable
4US-ASCII & base64
5ISO-8859-1 & quotable-printable
6ISO-8859-1 & base64
7ISO-8859-1 & 8bit
8ISO-8859-1 & binary
9Reserved
10ISO-2022-JP (Japanese) & 7 bit
11ISO-2022-KR (Korean) & 7 bit
12ISO-2022-CN (Traditional & Simplified Chinese) & 7 bit
13HZ-GB-2312 (Simplified Chinese) & 7 bit
14Shift-JIS (Japanese) & base64
15UTF-8 & quoted-printable
16UTF-8 & base64

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 at the nearest word break before the maximum line length. Any number may be specified but it is recommended that line lengths be kept below 80 characters. 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 bodyType. 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 in UTF-8 encoded in quotedprintable:

 $err:=SMTP_SetPrefs(-1;15;-1)
 $err:=SMTP_QuickSend(...)

 
PROPERTIES 

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

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D Internet Commands v11.2

 
SEE ALSO 

SMTP_Charset
SMTP_GetPrefs