4D Internet Commands v14

SMTP_MessageID

Home

 
4D Internet Commands v14
SMTP_MessageID

SMTP_MessageID 


 

SMTP_MessageID ( smtp_ID ; message_ID {; option} ) -> Function result 
Parameter Type   Description
smtp_ID  Longint in Message reference
message_ID  Text in Unique ID of message
option  Integer in 0 = Add (default), 1 = Replace, 2 = Delete
Function result  Integer in Error code

The SMTP_MessageID command add a "message-id" field in the header of the message whose reference is passed in smtp_ID. This unique ID is used in particular on forums or public mailing lists. In general, mail servers automatically add this header to the messages they send. You can use this command to define its contents. 

smtp_ID contains the ID of an e-mail created with the SMTP_New command.

In message_ID, you pass an ID to associate with the message. The contents you pass is normally unrestricted, however conventionally, it is usually in the form "lettersOrNumbers@domainname", for example "abcdef.123456@4d.com". Note that certain e-mail servers (such as Gmail) do not recognize custom "message-id" headers and replace them when they are not in this form. 

The option parameter lets you specify whether any existing message_ID header should be kept or removed:

  • If you pass 0 (default value if parameter is omitted), the contents of the parameter passed are added to the existing contents.
  • If you pass 1, the contents of the parameter passed replace the existing contents.
  • If you pass 2, the existing contents are removed from the message.

Example  

In this example, a message with a specific "message-id" header is sent for each record of the [Admin] table:

 $error:=SMTP_New($smtp_id)
 $error:=SMTP_Host($smtp_id;"infoserv.com")
 $error:=SMTP_From($smtp_id;"info@infoserv.com")
 $error:=SMTP_Subject($smtp_id;"General statistics")
 FIRST RECORD([Admin])
 For($i;1;Records in selection([Admin]))
    $error:=SMTP_Body($smtp_id;$Stats)
    $error:=SMTP_To($smtp_id;[Admin]Email;1) // Replaces the "A" header with a new value
    $error:=SMTP_MessageID($smtp_id;[Admin]ID+"@infoserv.com";1) // Use of the admin ID
    $error:=SMTP_Send($smtp_id)
    NEXT RECORD([Admin])
 End for
 $error:=SMTP_Clear($smtp_id)

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC Send Mail

 
HISTORY 

New
Created: 4D Internet Commands v14

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v14 R2)
4D Internet Commands ( 4D Internet Commands v14)
4D Internet Commands ( 4D Internet Commands v14 R3)
4D Internet Commands ( 4D Internet Commands v14 R4)