PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example: Closing an email session that is using the POP3/SMTP protocol
  • Example: Closing an email session via MS Exchange
  • Example: Closing an email session via Pocket Outlook
EmailCloseSession (Example)
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 by EmailStartSession (address of POP3 server, address of SMTP server, 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
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC) The following code is using MS Exchange to send an email. A profile ("PROFILE_Example") was created in MS Exchange. See EmailStartSession for more details.
The session is closed when the email is sent.
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)
Example: Closing an email session via Pocket Outlook
Windows Mobile
The following code is using Pocket Outlook to send an email. An account ("Example_Account") was created in Pocket Outlook. See Managing emails via CEMAPI: Other accounts for more details.
The session is closed when the email is sent.
EmailID is int
EmailID = EmailStartSession("Example_Account")
// Initialize the variables
Email.NbRecipient = 1
Email.Recipient[1] = "windev@windev.com"
Email.NbAttach = 0
Email.Message = ""
// Send the message
EmailSendMessage(EmailID)
...
EmailCloseSession(EmailID)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment