|
|
|
|
|
- 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
- Remarks
Managing the emails with the POP3/SMTP protocols
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.
  The SSL connections are supported.
Sending messages by using the SMTP protocol To send messages by using the SMTP protocol, you must: - Start an SMTP session:
- Build the message to be sent in a variable of type Email or in the Email structure.
- Send the message with EmailSendMessage.
- Close the SMTP session with EmailCloseSession.
Receiving messages by using the POP3 protocol To receive emails by using the POP3 protocol, you must: - Start a POP3 session:Example for starting a session by using an emailPOP3Session variable:
// Start the messaging session MySession is emailPOP3Session MySession.ServerAddress = "pop.mycompany.us" MySession.Name = "user" MySession.Password = "secret" EmailStartSession(MySession)
- Read the messages on the messaging server:
- with the EmailGetAll function.
- with a loop such as:
- Example that uses an Email variable:
MyMessage is Email EmailReadFirst(MySession, MyMessage) WHILE NOT MyMessage.Out // Place the process of the message read... ... EmailReadNext(MySession, MyMessage) END - Example that uses the Email structure:
EmailReadFirst(MySession) WHILE NOT Email.Out // Place the process of the message read... ... EmailReadNext(MySession) END
- or with a loop such as:
MyMessage is Email FOR EACH MyMessage OF MySession // Place the process of the message read... ... END
- Close the POP3 session with EmailCloseSession.
Remark: It's possible to open a POP3 session and an SMTP session simultaneously using the EmailStartSession function.
Related Examples:
|
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.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|