4D Internet Commands v12.1

SMTP_Send

Home

 
4D Internet Commands v12.1
SMTP_Send

 

SMTP_Send 


 

SMTP_Send ( smtp_ID {; sessionParam} ) -> Function result 
Parameter Type   Description
smtp_ID  Longint in Message reference
sessionParam  Longint in 1 = Use SSL, 0 or omitted = Do not use SSL
Function result  Integer in Error Code

The SMTP_Send command sends the message referenced by smtp_ID but does not clear the data from memory.

smtp_ID is the long integer reference to the mail message created with the SMTP_New command.

The optional sessionParam parameter enables the SSL protocol for a connection:

  • If you pass 1, the message will be sent in SSL (synchronous mode),
  • If you pass 0 or omit this parameter, the message will be sent in standard, non-secure mode.

Example  

In this example a message is created and the static elements are defined outside the scope of the 'for' loop. Then, for each record in the [People] table, the message is customized and sent.

 $error:=SMTP_New($smtp_id)
 $error:=SMTP_Host($smtp_id;"wkrp.com")
 $error:=SMTP_From($smtp_id;"herb_tarlick@wkrp.com")
 $error:=SMTP_ReplyTo($smtp_id;"bigguy@wkrp.com")
 $error:=SMTP_Subject($smtp_id;"Discounts on Ad Space!")
 FIRST RECORD([People])
 For($i;1;Records in selection([People]))
    If([People]Sales2Date>100000)
       $Body:=◊BigDiscText
    Else
       $Body:=◊SmlDiscText
    End if
    $Body:=Replace string($BoilerPlate;"<Salutation>";[People]Firstname)
    $error:=SMTP_To($smtp_id;[People]Email;1) `Replace the "To" header with new value
    $error:=SMTP_Body($smtp_id;$Body)
    $error:=SMTP_Send($smtp_id)
    NEXT RECORD([People])
 End for
 $error:=SMTP_Clear($smtp_id)

 
PROPERTIES 

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

 
HISTORY 

New
Created: 4D Internet Commands 6.5
Modified: 4D Internet Commands v12.1

 
SEE ALSO 

SMTP_New