AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / Desarrollar una aplicación o un sitio web / Controles, ventanas y páginas / Controles: tipos disponibles / Control Área de texto enriquecido
  • Example: Sending a custom email
EmailSend (Example)
Example: Sending a custom email
The following code is used to send an email whose content is entirely customized. The email variables are used to enter the main characteristics of the email.
The session is closed when the email is sent.
// Create the message
MessageContent is string
MessageContent = "Return-Path: <%1>" + CR + ...
"From: ""%2"" <%1>" + CR + ...
"To: <%3>" + CR + ...
"Subject: %4" + CR + ...
"MIME-Version: 1.0" + CR + ...
"Content-Type: text/plain;" + CR + ...
"Charset=""us-ascii""" + CR + ...
"Content-Transfer-Encoding: 7bit" + CR + CR + "%5" + CR
 
// Start an SMTP session
EmailStartSMTPSession("SMTPSession", "HL")
IF ErrorOccurred = True THEN
Error(ErrorInfo(errSummary))
RETURN
END
 
// Reset the Email variables to zero
EmailReset()
 
// Sender of the message
Email.Sender = "sender@sender.com"
Email.SenderAddress = "M. Sender"
 
// Recipients of the message
Email.NbRecipient = 1
Email.Recipient[1] = "recipient@recipient.com"
 
// Subject and content of the message
Email.Subject = "Email subject"
Email.Message = "Email body"
IF fSaveText("EmailContent.txt", ...
StringBuild(MessageContent, Email.Sender, Email.SenderAddress, ...
Email.Recipient[1], Email.Subject, Email.Message)) = False THEN
Error(ErrorInfo())
ELSE
EmailSend("SMTPSession", "EmailContent.txt")
IF ErrorOccurred = True THEN
Error(ErrorInfo())
END
END
 
// Close the SMTP session
EmailCloseSession("SMTPSession")
fDelete("EmailContent.txt")
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local