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
  • Overview of POP3/SMTP protocols
  • The POP3 and SMTP protocols
  • Principle
  • Sending messages by using the SMTP protocol
  • Receiving messages by using the POP3 protocol
  • Principle and specific features in WINDEV
  • Principle and specific features in WEBDEV
  • Remarks
  • Connection to the service provider
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview of POP3/SMTP protocols

The POP3 and SMTP protocols

  • The POP3 protocol (Post Office Protocol) is used to receive emails.
  • The SMTP protocol (Simple Mail Transfer Protocol) is used to send emails.
Remarks:
  • The reception of emails can also be taken into account by using the IMAP protocol.
  • WINDEVWindowsLinux The SSL connections are supported.
Principle

Sending messages by using the SMTP protocol

To send messages by using the SMTP protocol, you must:
  1. Start an SMTP session:
  2. Build the message to be sent in a variable of type Email or in the Email structure.
  3. Send the message with EmailSendMessage.
  4. Close the SMTP session with EmailCloseSession.

Receiving messages by using the POP3 protocol

To receive emails by using the POP3 protocol, you must:
  1. Start a POP3 session:Example for starting a session by using an emailPOP3Session variable:
    // Ouverture de la session de messagerie
    MaSession is emailPOP3Session
    MaSession.ServerAddress = "pop.masociete.fr"
    MaSession.Name = "utilisateur"
    MaSession.Password = "secret"
    EmailStartSession(MaSession)
  2. Read the messages on the messaging server:
    • with the EmailGetAll function.
    • with a loop such as:
      • Example that uses an Email variable:
        MonMessage is Email
        EmailReadFirst(MaSession, MonMessage)
        WHILE NOT MonMessage.Out
        	// Placer ici le traitement du message lu...
        	...
        	EmailReadNext(MaSession, MonMessage)
        END
      • Example that uses the Email structure:
        EmailReadFirst(MaSession)
        WHILE NOT Email.Out
        	// Placer ici le traitement du message lu...
        	...
        	EmailReadNext(MaSession)
        END
    • or with a loop such as:
      MonMessage is Email
      FOR EACH MonMessage OF MaSession
      	// Placer ici le traitement du message lu...
      	...
      END
  3. Close the POP3 session with EmailCloseSession.
Remark: It's possible to open a POP3 session and an SMTP session simultaneously using the EmailStartSession function.
WINDEVWindowsLinuxJavaUser code (UMC)

Principle and specific features in WINDEV

Principle and specific features in WINDEV

Note: It may be necessary to establish a modem connection before opening the SMTP or POP3 session.
WindowsLinux

Principle and specific features in WEBDEV

Sending and receiving emails in a WEBDEV website
In a WEBDEV website, the emails are sent and received by the Application Server.
The sending can be performed by a local spooler in order not to slow down a WEBDEV website if the SMTP server takes time to respond. This function is handled automatically by the WEBDEV Application Server.
Remarks
WINDEV

Connection to the service provider

An Internet connection is required to manage the emails. Several cases may occur:
  • The user uses a modem to connect to the Internet: the NetOpenRemoteAccess function opens the Internet connection.
  • The user uses a direct connection to Internet (cable or ADSL): no specific operation required.
Note To limit connection time:
  • When reading the emails, we advise you to read all the incoming emails and to save them in an HFSQL database for example.
  • When sending the emails, we advise you to prepare the emails beforehand.
Related Examples:
The POP3 Email functions Unit examples (WINDEV): The POP3 Email functions
[ + ] Using the Email functions to manage the POP3 protocol.
This protocol is used to retrieve emails from a server.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help