ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Managing emails
  • Asynchronous mode
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Sends an email using SMTP: the email is directly sent to the server. The email is actually sent when disconnecting from the SMTP server (i.e. when the session is closed).
Caution: Before sending the email, you must:
PHP In this version, the emails can be sent via the SMTP protocol only. Before sending this email, there is no need to start a session with <emailSMTPSession variable>.StartSession. To actually send the email, the SMTP server to use must be supplied to the PHP engine. It must be specified in the "SMTP =" entry of PHP.INI file.
Example
WEBDEV - Server codeAjax Sending a message by SMTP
// Start an SMTP session
MySession is emailSMTPSession
MySession.ServerAddress = "smtp.mycompany.us"
MySession.StartSession()
 
// Build an email
MyMessage is Email
MyMessage.Sender = "ordering_department@mycompany.fr"
MyMessage.Recipient.Add("customer@company.com")
MyMessage.Subject = EDT_EmailSubject
MyMessage.Message = "EDT_EmailText"
 
// Send the message
MySession.SendMessage(MyMessage)
Syntax

Sending an email using SMTP Hide the details

<Result> = <Session>.SendMessage([<Email> [, <Advanced options>]])
<Result>: Boolean
  • True if the message was sent to the SMTP server,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Session>: Control name
Identifies the user session. Corresponds to:
PHP This parameter is not available.
<Email>: Optional Email variable
Name of the Email variable corresponding to the email to be sent. If this parameter is not specified, the information contained in the Email structure is used.
PHP This parameter is not available.
<Advanced options>: Optional Integer constant
Combination of following constants:
emailOptionEncodeHeaderEncodes the message headers in Quoted-Printable if necessary.
The headers of messages are not encoded by default. This constant prevents the reception of email with wrongly decoded accented characters.
emailOptionMessageIDTakes the Email.MessageID variable into account to generate the email. This option is ignored if this variable is not specified.
This option is an advanced option.
emailOptionReferenceTakes the Email.Reference variable into account to generate the email. This option is ignored if this variable is not specified.
This option is an advanced option.
PHP This parameter is not available.
Remarks
WEBDEV - Server codeAjax

Asynchronous mode

If the session was started in asynchronous mode (<emailSMTPSession variable>.StartSession and EmailStartSMTPSession), <emailSMTPSession variable>.SendMessage creates an identifier for each email sent.
The email identifier is stored in the Email.MailIdentifier variable and can be used by EmailStatus to get the current status of the outgoing email (sent, in progress, etc.).
Processing the errors in asynchronous mode: <emailSMTPSession variable>.SendMessage returns True if the email is placed in the email spooler, False if the spooler cannot be contacted. To determine if the email was sent, use EmailStatus.
Component: wd290com.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help