PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Example: Closing an email session that is using the POP3/SMTP protocol
  • Example: Closing an email session via MS Exchange
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 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
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax The following code is using MS Exchange to send an email. A profile ("PROFILE_Example") was created in MS Exchange. For more details on how to create profiles, see EmailStartSession.
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)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment