ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Managing emails
  • Special cases
  • Members of the Email structure taken into account
  • 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
Starts the native application for sending emails found on the current computer:
  • Computer running Windows (using the MAPI client),
  • Mobile devices: Android, iPhone, iPad, Universal Windows 10.
The content and recipients of the email message are initialized from the information specified in the WLanguage Email structure.
Caution:
  • The application for sending emails found on the current computer must have been configured with a valid account for sending emails (SMTP).
  • The current directory can be modified according to the configuration of the application for sending emails.
WINDEV Remarks:
  • This function is based on the MAPI client installed on the computer ("Simple MAPI" is not sufficient). If the MAPI client is not found, the function searches for the default client among: Microsoft Outlook, Outlook Express, Eudora, IncrediMail, Netscape, Mozilla Thunderbird, Mozilla.
  • Both the application and the MAPI client must be in 32 bits or in 64 bits. If the client is a 64-bit application, it will only be seen by applications compiled in 64-bit (and similarly, if the client is a 32-bit application, it will only be seen by applications compiled in 32-bit)..
    New in version 2025
    Use EmailAppGetArchitecture to find out the default Email client execution mode. Depending on the MAPI client's architecture, you can also launch a 32 or 64-bit application to run the client.
Example
// Envoi d'un message avec pièce jointe 
Email.Recipient[1] = "destinataire@mail.com"
Email.NbRecipient = 1
Email.Subject = "Sujet du message"
Email.Message = "Texte du message"
// Photo.jpg est un fichier qui a été créé par l'application
Email.Attach[1] = SysDirExternalStorage(1, ssePublicDocument) + [fSep] + "photo.jpg"
Email.NbAttach = 1
EmailRunApp()
New in version 2025
WINDEV
nArchitecture is int = EmailAppGetArchitecture()
IF ErrorOccurred THEN
	Error("Impossible de déterminer l'architecture du mailer par defaut.")
	RETURN
END
<COMPILE IF Configuration32>
	IF nArchitecture = arch32 THEN
		EmailRunApp()
	ELSE
		// Lance un exécutable WINDEV 64 bits pour lancer le programme de messagerie
		ExeRun(fExeDir() + [fSep()] + "LanceMailer_64.exe")
	END
	RETURN
<END>
<COMPILE IF Configuration64>
	IF nArchitecture = arch64 THEN
		EmailRunApp()
	ELSE
		// Lance un exécutable WINDEV 64 bits pour lancer le programme de messagerie
		ExeRun(fExeDir() + [fSep()] + "LanceMailer_64.exe")
	END
	RETURN
<END>
Error("Impossible de déterminer l'architecture de l'application")
Syntax
EmailRunApp()
Remarks

Special cases

  • A non-fatal error is triggered if no application for sending emails is found on the current computer. To find out whether the application for sending emails failed to start, use the ErrorOccurred variable.
  • AndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst EmailRunApp can be used in the emulator. It cannot be used in the simulator.
  • AndroidAndroid Widget The default email application included in earlier versions of Android (<= 1.6) does not allow messages to be initialized with more than one attachment. In this case, only the first attachment described in Email.Attach will be associated with the message.
  • AndroidAndroid Widget In Android, if the message to be sent includes attachments, these must be located on shared memory (e.g. the SDCard) in order to be accessible to the mail client.
  • To reinitialize the Email structure, use EmailReset.
  • EmailRunApp is a non-blocking function. The code that follows the call to this function will continue to run as soon as the application for sending emails is started.
  • There is no way to find out whether the sending of the email was validated by the user.

Members of the Email structure taken into account

WINDEVAndroid Only the following members of the Email structure will be taken into account when initializing the message to send:
  • Email.Attach
  • Email.Cc
  • Email.Bcc
  • Email.Bcc
  • Email.Recipient
  • Email.Message
  • Email.NbAttach
  • Email.NbCc
  • Email.NbBcc 
  • Email.NbBcc
  • Email.NbRecipient
  • Email.Subject
iPhone/iPadIOS WidgetMac Catalyst The following members are taken into account:
  • Email.Attach
  • Email.Cc
  • Email.Bcc
  • Email.Recipient
  • Email.Message
  • Email.Subject
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.
EmailRunApp 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 Expense Account Cross-platform examples (WINDEV Mobile): WM Expense Account
[ + ] This example allows you to manage your fees.

Let's see the main features of this application:
- The input of invoices
- Management of foreign currencies
- Inclusion of photo document for the invoices
- Ability to email the expense account
- Ability to track the expense accounts
- ...
Component: wd300com.dll
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help