ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Managing emails
  • The email structure
  • 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 via the SMTP protocol while controlling the "buffer" of the email.
This function is an advanced function used to entirely configure the email sent. This function must only be used to manage the specific emails not managed by EmailSendMessage. For more details, see Writing an email.
Remark: The entire email description can be found in the reference documents of the Internet standard: RFC822 and RFC2045 to RFC2049. These documents are available on Internet (use a search engine with the references of the documents).
You also have the ability to use the emailSMTPSession and Email variables as well as EmailImportSource to send a message while controlling the source of the message.
// Initialize the email structure
Email.NbRecipient = 1
Email.Recipient = "support_test@pcsoft_test.fr"
Email.Sender = "customer@company.fr"
Email.Message = "Auto Email Test"
 
// Build the message
IF EmailBuildSource() = False THEN
Error(ErrorInfo())
RETURN
END
 
IF fSaveText("C:\MyEmails\EmailContent.txt", Email.Source) = False THEN
Error(ErrorInfo())
ELSE
EmailSend("SMTPSession", "C:\MyEmails\EmailContent.txt")
IF ErrorOccurred = True THEN
Error(ErrorInfo())
END
END
END
Syntax
<Result> = EmailSend(<Username> , <File name>)
<Result>: Boolean
  • True if the function was successfully run,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Username>: Character string
Identifies the user session. Corresponds to the username that was used to start the email session (EmailStartSession).
<File name>: Character string
Identifies the file containing the entire email formatted according to the parameters expected by the SMTP server.
Remarks

The email structure

When sending the email, only the variables of the email structure required by the SMTP protocol are taken into account. The other variables are ignored.
Remark: For more details, see The email structure.
WEBDEV - Server codeAjax

Asynchronous mode

If the session was started in asynchronous mode (EmailStartSession and EmailStartSMTPSession), EmailSend creates an identifier for each email sent.
This identifier is stored in the Email.MailIdentifier variable and can be used with EmailStatus to get the current status of the outgoing email.
Component: wd300com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help