PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Asynchronous mode
  • Progress bar
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Sends an email:
  • by using the SMTP protocol: the email is directly sent to the server. The email is actually sent when disconnecting from the SMTP server (which means when closing the session).
  • WINDEVWEBDEV - Server code via the MS Exchange client: the email is placed in the out-box of MS Exchange. To actually send the email, use EmailUpdate.
  • Windows Mobile via Pocket Outlook (user account other than the "ActiveSync" account): the email is placed in the out-box of Pocket Outlook.
  • WINDEVWEBDEV - Server code via the Lotus Notes software: the email is placed in the out-box of the messaging software. The email is automatically sent by the spooler of Domino. Caution: Lotus Notes must be installed in connected mode (and not in local mode).
  • WINDEVWEBDEV - Server code via the Outlook software: the email is placed in the out-box of the messaging software. The email is actually sent from Outlook. See Accessing Outlook for more details.
Caution: Before sending the email, you must:
AndroidAndroid Widget iPhone/iPadUniversal Windows 10 AppJava In this version, the emails can be sent via the SMTP protocol only.
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 EmailStartSession. 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.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 22 and later
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
New in version 22
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 AppJavaAjaxUser code (UMC) Sending a message by SMTP
// Start an SMTP session
MySession is EmailSMTPSession
MySession..ServerAddress = "smtp.mycompany.us"
EmailStartSession(MySession)

// Build an email
MyMessage is Email
MyMessage..Sender = "service_order@mycompany.fr"
Add(MyMessage..Recipient, "customer@company.com")
MyMessage..Subject = EDT_EmailSubject
MyMessage..Message = EDT_EmailText

// Send the message
EmailSendMessage(MySession, MyMessage)
PHP Sending a message from a PHP WEBDEV site
// Note: starting an SMTP session is not required

// Build an email (by using the Email structure)
Email.Sender = "purchasing_department@mycompany.com"
Email.NbRecipient = 1
Email.Recipient[1] = "customer@company.com"
Email.Subject = EDT_EmailSubject
Email.Message = EDT_EmailText

// Send the message
EmailSendMessage()
Syntax

Sending an email by using the SMTP protocol Hide the details

<Result> = EmailSendMessage(<Session> [, <Email>] [, <Advanced Options>])
<Result>: Boolean
  • True if the message was sent to the SMTP server,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
Java If an error occurs, the content of the Email.Error variable must be checked.
<Session>: Character string or emailSMTPSession variable
Identifies the user session. Corresponds to:
PHP This parameter is not available.
<Email>: Optional Email variable
Versions 15 and later
Name of Email variable corresponding to the email to send. If this parameter is not specified, the information found in the Email structure is used.
JavaPHP This parameter is not available.
New in version 15
Name of Email variable corresponding to the email to send. If this parameter is not specified, the information found in the Email structure is used.
JavaPHP This parameter is not available.
Name of Email variable corresponding to the email to send. If this parameter is not specified, the information found in the Email structure is used.
JavaPHP This parameter is not available.
<Advanced Options>: Optional Integer constant
Combination of following constants:
Versions 15 and later
emailOptionEncodeHeader
New in version 15
emailOptionEncodeHeader
emailOptionEncodeHeader
Encodes the message header in base 64.
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.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileAjaxUser code (UMC)

Sending an email via MS Exchange, Pocket Outlook, Lotus Notes or Outlook Hide the details

<Result> = EmailSendMessage(<Session ID> [, <Email>] [, <Display> [, <Type>]])
<Result>: Boolean
  • True if the message was placed in the out-box of MS Exchange, Lotus Notes or Outlook,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
Windows Mobile Special cases:
  • True if the message was placed in the out-box of Pocket Outlook,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Session ID>: Integer or emailOutlookSession variable
Identifies the current email session. This parameter can be:
<Email>: Optional Email variable
Versions 15 and later
Name of Email variable corresponding to the email to send.
If this parameter is not specified, the information found in the Email structure is used.
New in version 15
Name of Email variable corresponding to the email to send.
If this parameter is not specified, the information found in the Email structure is used.
Name of Email variable corresponding to the email to send.
If this parameter is not specified, the information found in the Email structure is used.
<Display>: Optional boolean
  • True to display the message in a dialog box before sending it,
  • False (by default) to display no dialog box.
This parameter is taken into account only if the email session was started by EmailStartSession, by using the MS Exchange syntax with a profile name. In the other cases, the dialog box is not displayed.
Note: This parameter is not available for Lotus Notes.
Windows Mobile This parameter is not available. You cannot display the message in a dialog box before sending it.
<Type>: Optional character string (with quotes)
Describes the type of message to send. By default, <Type> = "IPM" (Inter Personal Message).
Windows Mobile This parameter is not available. You cannot specify the type of message to send.
Remarks
WEBDEV - Server codeAjax

Asynchronous mode

If the session was started in asynchronous mode (EmailStartSession and EmailStartSMTPSession), EmailSendMessage creates an identifier for each email sent.
The email identifier is stored in the Email.MailIdentifier variable and it can be used by EmailStatus to find out the current status of outgoing email (sent, in progress, ...).
Processing the errors in asynchronous mode: EmailSendMessage returns True if the email is placed in the email spooler, False if the spooler cannot be contacted. To find out whether the email was sent, you must use EmailStatus.
WINDEVReports and QueriesAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 AppUser code (UMC)

Progress bar

To follow the sending progress, use EmailProgressBar.
Related Examples:
Sending an email in HTML format Unit examples (WINDEV): Sending an email in HTML format
[ + ] Using the WLanguage "EmailImportHTML" function.
This function is used to import an HTML file into the email structure. This allows you to easily add images into the emails.
Sending emails Unit examples (WEBDEV): Sending emails
[ + ] This training example explains how to send emails with WEBDEV.
WD Mailshot Training (WINDEV): WD Mailshot
[ + ] This example explains how to send a mailshot with WINDEV.

This example is used to type the subject of the message, its content and its attachments.
Then, the user must select the customers to which the message will be sent.
The WLanguge EmailSendMessage() function is used to send the message to each selected customer.
Technical implementation:
An email server compatible with POP3/SMTP must necessarily be accessible from the computer on which the application is run.
WD JavaMail Training (WINDEV): WD JavaMail
[ + ] This example is a Java example used to create an applet.
This applet can then be used in an Internet page.
This applet enables you read and send emails.
In this project, a second configuration enables you to manage a "Standard" Java application (.jar).
To generate the Java applet and the "Standard" Java application, select "Workshop - Java - Generate the Java archive",
for each one of the two configurations of project.
Pocket Managing Contacts Mobile (WINDEV Mobile): Pocket Managing Contacts
[ + ] This example presents the management of contacts in Pocket PC.
The following topics will be presented in this example:
1/ the loopers
2/ the use of queries
3/ sending SMSs
4/ sending emails
5/ the phone call.
WW_CMS Complete examples (WEBDEV): WW_CMS
[ + ] This example is an example of CMS (Content Management System).
This is a site for content management, typically a site for displaying some articles.

This example is divided into 2 parts:
- An AWP part for the part that must be referenced
- A WEBDEV part for the management part

Note:
In order for some features of the example to operate (sending emails for example), the parameters must be modified in order to adapt them to your configuration.
These parameters are stored as constants defined in the code of the project.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Java wd230java.jar
Linux wd230com.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment