4D v15

SMTP_QuickSend

Home

 
4D v15
SMTP_QuickSend

SMTP_QuickSend  


 

 

SMTP_QuickSend ( hostName ; msgFrom ; msgTo ; subject ; message {; sessionParam}{; port}{; userName ; password} ) -> Function result

ParameterTypeDescription
hostNameString->Host name or IP address
msgFromText->MailAddress or AddressList
msgToText->MailAddress or AddressList
subjectText->Subject of message (UTF-8 by default)
messageText->Message (UTF-8 by default)
sessionParamLongint->0 or omitted = Do not use SSL but switchover allowed, 1 = Use SSL, 2 = Never use SSL (switchover not allowed), 4 = Send HTML text without SSL, 5 = Send HTML text with SSL, 8 = Send Mime HTML without SSL/TLS, 9 = Send Mime HTML with SSL/TLS
portLongint->Number of port to use
userNameText->User name for authentication
passwordText->Password for authentication
Function resultInteger<-Error Code

Originally introduced in 4D v14 R5

The SMTP_QuickSend command now allows you to send messages with the Mime HTML format, with or without the SSL/TLS protocol. Mime HTML (.mht or .mhtml file extension) is a Web page archive format that can merge the HTML code as well as external resources such as images into a single document. It is supported by several browsers as well as MS Word, for example. Since this format is supported by 4D Write Pro areas, you will easily be able to save and send 4D Write Pro areas including all their resources by e-mail.

Pass 8 in sessionParam to format the message in Mime HTML and send it in standard mode.
Pass 9 in sessionParam to format the message in Mime HTML and send it in SSL/TLS mode.

These values correspond to usual combinations, however the sessionParam parameter is a actually a bit field and allows any custom combination if you use bitwise operators:

Bit numberFormat used if bit is 1
0Use SSL or use default behavior, connect in clear, then upgrade to SSL if possible.
1Never upgrade, stay in non-encrypted mode even if upgrade is possible. Bit is ignored if SSL (bit-0) is selected.
2Message body is HTML; set the header accordingly.
3MHTML message, bit-2 (HTML) is ignored. User is responsible to set everything up, except "To", "From", "Date", and "Subject"

Note: This command does not support converted databases running in "Non-Unicode" mode.

You saved a .mht document on your disk and want to send it by e-mail. To do this, you can write:

 $Message:=Document to text("c:\\documents\\invitation.mht")
 $Host:="smtp.gmail.com"
 $ToAddress:="john@4d.com"
 $FromAddress:="harry@gmail.com"
 $Subject:="Let's party"
 $Param:=9 //MHTML with SSL
 $Port:=465 //SSL port of gmail
 $User:="harry@gmail.com"
 $Password:="xyz&@!&@"
 $Error:=SMTP_QuickSend($Host;$FromAddress;$ToAddress;$Subject;$Message;$Param;$Port;$User;$Password)

 
EIGENSCHAFTEN 

Produkt: 4D
Thema: 4D Internet Commands

 
GESCHICHTE 

 
ARTIKELVERWENDUNG

4D v15 - Upgrade (Standard Edition) ( 4D v15)