PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • POP3 and SMTP protocols
  • Authenticated SMTP
  • Time-out
  • Creating an Outlook Exchange profile
  • Pocket Outlook: Creating an account
  • Managing emails in asynchronous mode
  • Required application feature
  • Gmail: What to do if a connection to Gmail (SMTP, IMAP, POP3) fails with a certificate error?
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
Starts a session for email management according to the selected management mode:
  • emails managed by the POP3, SMTP or IMAP protocol: EmailStartSession is used to start the POP3, SMTP or IMAP session.
  • WINDEVWEBDEV - Server codeWindows Mobile emails managed via the MS Exchange client or via Pocket Outlook: EmailStartSession is used to start the MS Exchange or Pocket Outlook session. In this case, the current directory is automatically modified when using EmailStartSession.
Java Only the POP3 and SMTP sessions are supported.
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.
Notes:
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.
// Send an email via the POP3 protocol
IF EmailStartSession(USER, PASSWORD, ...
"pop3.gmail.com", "smtp.gmail.com") = True THEN
UserName = USER
ELSE
UserName = ""
Error("Unable to establish the connection")
END
Syntax

Starting an email session (POP3, SMTP, IMAP, Notes or Outlook) Hide the details

<Result> = EmailStartSession(<Session>)
<Result>: Boolean
  • True if the session was started,
  • False otherwise. The ErrorOccurred variable is set to True if an error occurred.
    To find out the error details, use ErrorInfo associated with the errMessage constant.
<Session>: emailPOP3Session, emailSMTPSession, emailIMAPSession, emailNotesSession or emailOutlookSession variable
Name of variable containing the description of parameters for connecting to the email server. All the connection properties are specified in the variable properties. For more details, see:
  • emailPOP3Session variable: to start a session toward a POP3 server in order to read messages.
  • emailIMAPSession variable: to start a session toward an IMAP server in order to read messages.
  • emailSMTPSession variable: to start a session toward an SMTP server in order to send messages.
  • WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC) emailNotesSession variable: to start a session toward a Lotus Domino server in order to handle messages.
  • WINDEVWEBDEV - Server codeReports and QueriesWindows MobileAjaxUser code (UMC) emailOutlookSession variable: to start a session toward the Outlook messaging software.
Note: This syntax is kept for backward compatibility. We recommend that you use the emailOutlookSession variables or EmailStartOutlookSession.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileAjaxUser code (UMC)

Starting an email session via MS Exchange or Pocket Outlook Hide the details

<Result> = EmailStartSession(<Profile> [, <Asynchronous>])
<Result>: Integer
  • Identifier of current email session.
  • 0 (or False) if an error occurred. The ErrorOccurred variable is set to True. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Profile>: Character string (with quotes)
Identifies the connection profile (see the Notes).
If this parameter corresponds to an empty string (""):
  • if several profiles are defined on the current computer, EmailStartSession displays a window containing all profiles among which the user can choose his own profile.
  • if a single profile is defined on the current computer, EmailStartSession automatically selects this profile.
Windows Mobile User account to use. If this parameter contains an empty string (""), the "ActiveSync" user account will be used.
<Asynchronous>: Optional constant or boolean
emailAsynchronous or TrueThe emails sent during the session started by EmailStartSession must be transmitted in asynchronous mode (see the Notes).
emailSynchronous or False
(Default value)
The emails sent during the session started by EmailStartSession must be transmitted in synchronous mode (see the Notes).
WINDEVWindows Mobile This parameter must correspond to emailSynchronous or False.
Note: This syntax is kept for backward compatibility. We recommend that you use the emailPOP3Session, emailSMTPSession variables or EmailStartPOP3Session and EmailStartSMTPSession.

Starting an email session by using the POP3 and SMTP protocols simultaneously Hide the details

<Result> = EmailStartSession(<User Name> , <Password> , <Address of POP3 Server> [, <Address of SMTP Server> [, <Number of POP3 Port> [, <Number of SMTP Port> [, <Asynchronous>]]]])
<Result>: Boolean
  • True if the session was started,
  • False otherwise. The ErrorOccurred variable is set to True if an error occurs. To find out the error details, use ErrorInfo associated with the errMessage constant.
<User Name>: Character string
Identifies the user. This name is supplied by the service provider or by the network administrator. This name will be used to identify the email session in the different functions for email management.
<Password>: Character string
User password. This password is given by the service provider or by the network administrator.
<Address of POP3 Server>: Character string
IP address of email server (incoming protocol). This IP address is supplied by the service provider or by the network administrator. This IP address can have the following format:
  • IP address in XXX.XXX.XXX.XXX format (125.5.110.100 for example).
  • IP address containing the server name (pop3.freesbee.eu for example). This syntax is recommended.
  • IP address returned by NetIPAddress.
<Address of SMTP Server>: Optional character string
IP address of email server (outgoing protocol). This IP address is supplied by the service provider or by the network administrator.
This address must be specified only if the POP3 account and the SMTP account do not go through the same computer.
<Number of POP3 Port>: Optional integer
Identifies the port used for the POP3 protocol (110 by default).
<Number of SMTP Port>: Optional integer
Identifies the port used for the SMTP protocol (25 by default).
<Asynchronous>: Optional constant or boolean
emailAsynchronous or TrueThe emails sent during the session started by EmailStartSession must be transmitted in asynchronous mode (see the Notes).
emailSynchronous or False
(Default value)
The emails sent during the session started by EmailStartSession must be transmitted in synchronous mode (see the Notes).
WINDEVWindows Mobile This parameter must correspond to emailSynchronous or False.
Remarks

POP3 and SMTP protocols

The different parameters passed to EmailStartSession are supplied by the Internet Service Provider or by the network administrator.
An Internet connection is required to manage the emails. Several cases may occur:
  • The user is using a direct connection to Internet (cable or ADSL): no specific operation is required.
  • The user is using a modem to connect to Internet: NetOpenRemoteAccess is used to establish the connection to Internet.
By default, if only the IP address of POP3 server is specified, this address will be used by the email server that is using the SMTP protocol. The IP address of SMTP protocol must be specified only if the POP3 account and the SMTP account do not use the same computer.

Authenticated SMTP

The SMTP authentication cannot be performed by EmailStartSession. To start a POP3 session and an authenticated SMTP session at the same time, you must use both EmailStartPOP3Session and EmailStartSMTPSession.

Time-out

The time-out can be configured by EmailSetTimeOut.
WINDEVWEBDEV - Server codeReports and QueriesWindowsAjaxUser code (UMC)

Creating an Outlook Exchange profile

To start a new email session, a "profile" must be defined. This "profile" is defined in the configuration of Internet connection.
To create a profile:
  1. Open the control panel.
  2. Double-click the "Email" option.
  3. Click the "Display the profiles" button.
  4. In the window named "Choosing a profile", click the "Add" button.
  5. Give a name to the profile. This name will be used in the WINDEV programs.
  6. Select "Add a new email account".
  7. Select the "Microsoft Exchange Server" service.
  8. Enter the name of Microsoft Exchange server.
Windows Mobile

Pocket Outlook: Creating an account

To start a new email session with Pocket Outlook, an "account" must be defined. See Managing emails via CEMAPI for more details.
WEBDEV - Server codeAjax

Managing emails in asynchronous mode

The email functions are locking functions by default. Which means that no other code can be run during their execution. The program will resume only when the current Email functions have been run.
WEBDEV gives you the ability to manage the emails in asynchronous mode. This mode allows your sites to send emails without locking the execution of other processes.
To use the asynchronous mode, you must:
  1. Uncheck "Disable the email spooler" in the WEBDEV administrator ("Configuration" tab).
  2. Enable the asynchronous mode when starting the SMTP session (with EmailStartSMTPSession or EmailStartSession).
  3. All the outgoing emails will be transmitted to a "spooler". The emails are queued up before they are sent.
The execution of Email functions do not lock the rest of your program anymore. EmailStatus is used to find out the email status.
Note: if the WEBDEV administrator is closed, the email spooler is cleared: the pending emails are not sent and they are removed form the spooler.
If "Disable the email spooler" is checked while emails are still found in the spooler, these emails will not be lost: the administrator keeps sending them but no new email is accepted by the spooler.
Caution: The asynchronous mode can only be used when starting a session on an SMTP server (EmailStartSMTPSession for sending emails or EmailStartSession). The asynchronous mode is ignored in all the other cases.
Versions 21 and later
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Family and corporate networks
This feature allows the applications to use incoming and outgoing accesses to the family and corporate networks.
New in version 21
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Family and corporate networks
This feature allows the applications to use incoming and outgoing accesses to the family and corporate networks.
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Family and corporate networks
This feature allows the applications to use incoming and outgoing accesses to the family and corporate networks.

Gmail: What to do if a connection to Gmail (SMTP, IMAP, POP3) fails with a certificate error?

Since August 2017, a new certificate was deployed by Google: Google Internet Authority G3. Unfortunately, the Windows API for checking certificates does not validate this certificate.
Therefore, starting a POP3, IMAP or SMTP session may fail with the error "The certificate string was not issued by a trusted authority".
To validate the certificate, all you have to do is modify the management mode of emails. The WLanguage EmailConfigure function allows you to change this mode and to no longer use the Windows API that locks this certificate. The following code must be added before starting the session via EmailStartSession:
// Enable the multi-platform implementation
EmailConfigure(emailParameterMode, 1)
Note: From version 23 Update 1, the call to EmailConfigure is not required anymore: WLanguage is automatically using the management mode of emails adapted to the session.
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