|
|
|
|
|
- Example: Sending an email using SMTP
- Example: Sending an email via MS Exchange
- Sending Email 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 NomUser = USER ELSE NomUser = "" Error("Impossible d'établir la connexion") END // Initialise les composantes du mail Email.Sender = "<user@pcsoft.fr>" // L'expéditeur Email.Recipient[1] = DESTINATAIRE // Le destinataire Email.NbRecipient = 1 // Le nombre de destinataires Email.Subject = SUJET // Le sujet Email.Message = TEXTE // Le corps du message Email.NbAttach = 0 // Le nombre de pièces attachées // Envoie le mail IF EmailSendMessage(NomUser) = False THEN Error() END Example: Sending an email via MS Exchange Sending Email via a secure SMTP server // Envoi d'email via un serveur SMTP Sécurisé // Session SMTP Sécurisée gSessionSMTP is emailSMTPSession gSessionSMTP.ServerAddress = "smtp.gmail.com" gSessionSMTP.Name = gsUser gSessionSMTP.Password = gsPassword gSessionSMTP.Port = 587 gSessionSMTP.Option = emailProtocolSMTPS // Contenu de l'email UnCourriel is Email UnCourriel.SenderAddress = gsUser UnCourriel.Recipient[1] = "pcsoft@pcsoft.fr" UnCourriel.Subject = "Envoi d'un email depuis WINDEV." UnCourriel.Message = "Envoi d'un message email depuis WINDEV." // Envoi de l'email IF EmailStartSession(gSessionSMTP) = True THEN IF EmailSendMessage(gSessionSMTP, UnCourriel) = False THEN Error("L'envoi de l'email a échoué.", ErrorInfo(errMessage)) END ELSE Error("Impossible d'établir la connexion", ErrorInfo(errMessage)) END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|