4D Internet Commands v12.1SMTP_Send |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D Internet Commands v12.1
SMTP_Send
|
SMTP_Send ( smtp_ID {; sessionParam} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
smtp_ID | Longint |
![]() |
Message reference | |||||
sessionParam | Longint |
![]() |
1 = Use SSL, 0 or omitted = Do not use SSL | |||||
Function result | Integer |
![]() |
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:
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)
Product: 4D Internet Commands
Theme: IC Send Mail
Number:
88989
Created: 4D Internet Commands 6.5
Modified: 4D Internet Commands v12.1