Example: Closing an email session that is using the POP3/SMTP protocol
The following code is used to send an email by using the SMTP protocol. The characteristics of the POP3/SMTP protocol have been specified using
EmailOuvreSession (POP3 server address, SMTP server address, etc.).
The session is closed when the email is sent.
IF EmailStartSession(USER, PASSWORD, "pop3.server.com", ...
"smtp.server.com") = True THEN
UserName = USER
ELSE
UserName = ""
Error("Unable to establish the connection")
END
// Initializes the email components
Email.Sender = "<user@pcsoft.fr>" // The sender
Email.Recipient[1] = RECIPIENT // The recipient
Email.NbRecipient = 1 // The number of recipients
Email.Subject = SUBJECT // The subject
Email.Message = TEXT // The body of the message
Email.NbAttach = 0 // The number of attachments
// Sends the email
IF EmailSendMessage(UserName) = False THEN
Error()
END
...
EmailCloseSession(UserName)
Example: Closing an email session via MS Exchange
EmailID is int
EmailID = EmailStartSession("PROFILE_Example")
// Initialize the variables
Email.NbRecipient = 1
Email.Recipient[1] = "windev@windev.com"
Email.NbAttach = 0
Email.Message = ""
// Send the message to MS Exchange
EmailSendMessage(EmailID)
...
EmailUpdate(EmailID)
...
EmailCloseSession(EmailID)