ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Web-specific functions / Browser functions
  • Action of EmailOpenMail
  • In which code should I use EmailOpenMail?
  • Special cases
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
EmailOpenMail (Function)
In french: EmailOuvreMessagerie
Opens the default messaging software:
  • of the user on the browser.
  • of the user on the current Windows computer.
  • AndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst on the phone.
AndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst Note: EmailRunApp can also be used to open a messaging application on a mobile device. We recommend using EmailRunApp to manage attachments, messages with multiple recipients, etc.
Example
// Opens the messaging software
EmailOpenMail()
// Opens the software and specifies the email recipient
// the subject and text of the email
EmailOpenMail("pcsoft@windev.com", "Subject: What's new in WINDEV", "Text: New features are now available")
Syntax
EmailOpenMail([<Email address> [, <Email subject> [, <Message body>]]])
<Email address>: Optional character string
Email address of recipient. This address will be displayed in the messaging software.
<Email subject>: Optional character string
Email subject that will be displayed in the messaging software.
<Message body>: Optional character string
Text of message. Non-alphanumeric characters are automatically converted in order to allow for special characters to be passed (carriage returns, tabulations, ...).
Remarks
WEBDEV - Browser code

Action of EmailOpenMail

EmailOpenMail triggers an action on the page displayed in the user's browser. However, Internet browsers allow one single action on the page per process.
For example, if a process performs the following actions:
  1. Send a page to the server (PageSubmit).
  2. Open the messaging software (EmailOpenMail).
Only the last action (open the messaging software) will be performed.
WEBDEV - Browser code

In which code should I use EmailOpenMail?

In WEBDEV, some types of buttons automatically trigger an action on the page:
  • "submit" button,
  • "other" button whose action differs from "none".
If EmailOpenMail is used in the browser-side click process of these buttons (or in a procedure called by this process), the function will be ignored. Only the button action will be performed.
Consequences: EmailOpenMail cannot be used in a code that triggers an action. This function is ignored:
  • in the click code of a "submit" button.
  • in the click code of an "other" button whose action is different from "none".
  • if it is followed by PageSubmit or by EmailOpenMail (in the current process, in a procedure called by the current process or in another process called by Execute).
To use EmailOpenMail from a button (browser click code of the button), this button must have the following characteristics:
  • button type: "Other".
  • action: "None".

Special cases

  • A non-fatal error is triggered if no email application is found on the device. To find out whether the email application failed to start, use the ErrorOccurred variable.
  • AndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst EmailOpenMail can be used in the emulator. It cannot be used in the simulator.
  • EmailOpenMail is a non-blocking function. The code that follows the call to this function will continue to run as soon as the email application is launched.
  • There is no way to find out whether the sending of the email was validated by the user.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

Starting with Android 10, it is no longer possible to open a window when the application is in the background.
EmailOpenMail can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Related Examples:
WM Managing Contacts Cross-platform examples (WINDEV Mobile): WM Managing Contacts
[ + ] This example presents the management of contacts for Android et iOS.
It is used o:
- list the contacts found on the phone
- call the contacts
- send SMSs to the contacts
- ...
Component: wd300com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/03/2025

Send a report | Local help