PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV, WINDEV Mobile 24 feature!
  • POP3 and SMTP protocols
  • Authenticated SMTP
  • Timeout
  • 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 managing emails via the SMTP protocol.
Note: To start a session for sending emails (via the SMTP protocol only), use EmailStartSMTPSession. This function can also be used to start an authenticated SMTP session.
Versions 22 and later
Android Widget This function is now available in Android Widget mode.
Android This function is now available for Android applications.
New in version 22
Android Widget This function is now available in Android Widget mode.
Android This function is now available for Android applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for Android applications.
Example
// Management of an SMTP email session
MyEmailSMTPSession is emailSMTPSession
IF MyEmailSMTPSession.StartSession() = True THEN
UserName = MySMTPSession..Name
ELSE
UserName = ""
Error("Unable to establish the connection")
END
Syntax
<Result> = <Session>.StartSession()
<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.
<Session>: emailSMTPSession variable
Name of the emailSMTPSession variable corresponding to the email session to handle.
Remarks

POP3 and SMTP protocols

The different parameters passed to <EmailSMTPSession variable>.StartSession 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 <EmailSMTPSession variable>.StartSession. To start a POP3 session and an authenticated SMTP session at the same time, you must use both EmailStartPOP3Session and EmailStartSMTPSession.

Timeout

The timeout can be configured by EmailSetTimeOut.
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 <EmailSMTPSession variable>.StartSession).
  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 <EmailSMTPSession variable>.StartSession). 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 <EmailSMTPSession variable>.StartSession:
// 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.
Component : wd240com.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment