|
|
|
|
|
- Example: Sending an email using SMTP
- Example: Sending an email via MS Exchange
- Sending emails via a secure SMTP server
EmailSendMessage (Example)
Example: Sending an email using SMTP The following code is used to send an email by using the SMTP protocol. The characteristics of SMTP protocol have been specified by EmailStartSession (address of POP3 server, address of SMTP server, etc.). IF EmailStartSession(USER, PASSWORD, "pop3.gmail.com", ...
"smtp.gmail.com") = True THEN
UserName = USER
ELSE
UserName = ""
Error("Unable to establish the connection")
END
Email.Sender = "<user@windev.com>"
Email.Recipient[1] = RECIPIENT
Email.NbRecipient = 1
Email.Subject = SUBJECT
Email.Message = TEXT
Email.NbAttach = 0
IF EmailSendMessage(UserName) = False THEN
Error()
END
Example: Sending an email via MS Exchange Sending emails via a secure SMTP server
gSMTPSession is emailSMTPSession
gSMTPSession.ServerAddress = "smtp.gmail.com"
gSMTPSession.Name = gsUser
gSMTPSession.Password = gsPassword
gSMTPSession.Port = 587
gSMTPSession.Option = emailProtocolSMTPS
AnEmail is Email
AnEmail.SenderAddress = gsUser
AnEmail.Recipient[1] = "pcsoft@windev.com"
AnEmail.Subject = "Sending an email from WINDEV."
AnEmail.Message = "Sending an email from WINDEV."
IF EmailStartSession(gSMTPSession) = True THEN
IF EmailSendMessage(gSMTPSession, AnEmail) = False THEN
Error("Failure sending the email.", ErrorInfo(errMessage))
END
ELSE
Error("Unable to establish the connection", ErrorInfo(errMessage))
END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|