AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Su versión: XXA230053K

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Gestión de correos electrónicos
  • Properties specific to Email variables
  • Correspondence between the properties and the RFC standard
  • WLanguage functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
The Email type is used to handle the email content as well as the associated information. The characteristics of an email can be defined and changed using different WLanguage properties.
This type replaces and extends the Email structure by giving you the ability to handle several messages at the same time.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Ejemplo
// Envoi d'un email

// Construction du message
MonMessage is Email
// Expéditeur
MonMessage.Sender = sExpediteur
// Destinataires
sDestinataire_1 is string = "aaa@gmail.com"
sDestinataire_2 is string = "bbb@gmail.com"
Add(MonMessage.Recipient, sDestinataire_1)
Add(MonMessage.Recipient, sDestinataire_2)
// Contenu du message
MonMessage.Subject = SAI_Sujet
MonMessage.Message = RTFToText(sNote)
MonMessage.HTML = RTFToHTML(sNote)

// Ouverture une session SMTP
MaSession is emailSMTPSession
MaSession.ServerAddress = sServeur
IF EmailStartSession(MaSession) = False THEN RETURN

// Envoi du message (la constante emailOptionEncodeEntête permet
// de prendre en compte les caractères accentués)
EmailSendMessage(MaSession, MonMessage, emailOptionEncodeHeader)

// Fermeture de la session
EmailCloseSession(MaSession)
Observaciones

Properties specific to Email variables

The following properties can be used to handle Email variables:
NameType usedEffect
Novedad versión 23
AsynchronousEmailIdentifier
Character stringEmail identifier (asynchronous mode only).
WEBDEV only
WINDEVLinuxUniversal Windows 10 AppAndroidWidget Android iPhone/iPad This property is not available.
AttachArray of emailAttachContains the description of attached files.
The number of attached files is unlimited.
For more details, see emailAttach.
Remark: If the file is attached manually, do not forget to specify the Name property, otherwise the image will not be sent along with the email. Example:
oEmail.Attach[1].Contenu = fLoadBuffer(fDataDir() +
["\"] + "Email\" + sLogoSociété)
oEmail.Attach[1].ContentType = "image/gif"
oEmail.Attach[1].Nom = "logo.gif"
BccArray of character stringsContains the addresses of non-official recipients: their name is not displayed in the email received by the official recipients (Recipient property).
The addresses are limited to 127 characters. The number of non-official recipients is limited to 200. This limit can be exceeded in SMTP mode. However, some servers do not support the emails with an important number of recipients.
CategoryCharacter stringList of keywords associated with the email. The keywords are separated by semicolons.
Remark: If one of the keywords contains special characters or accented characters, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.
CcArray of character stringsContains the addresses of recipients in copy: their name is displayed in the email received by the official recipients (Recipient property).
The addresses are limited to 127 characters.
The number of recipients in copy is limited to 200. This limit can be exceeded in SMTP mode. However, some servers do not support the emails with an important number of recipients.
CertificateCertificateCertificate used to sign the email (header, content and attachments) before sending it.
LinuxUniversal Windows 10 AppAndroidWidget Android iPhone/iPad This property is not available.
DispositionNotificationBooleanOutbound, used to request a confirmation that the email was read by the recipient (True). The recipient does not necessarily have to send a read receipt.
Inbound, used to find out whether a read receipt was requested by the sender (True) or not.
If a read receipt is requested, it has priority over the delivery receipt.
This property is set to False by default.
WINDEVWEBDEV - Código Servidor This property is not supported in Lotus Notes.
This property is supported by Outlook in Windows.
HeaderArray of emailHeaderHeaders of email.
HTMLCharacter stringMessage with HTML formatting. Limited to 4 GB.
This property is supported in POP3/SMTP only.
IDCharacter stringUnique email identifier. This identifier remains constant for the entire email lifetime. This identifier is initialized when sending the email (EmailSendMessage).
Remark: If the identifier contains special characters or accented characters, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.
WINDEVWEBDEV - Código Servidor This property is supported by the Outlook messaging and by the Lotus Notes messaging only.
MessageCharacter stringText of message (with simple text formatting). Limited to 2 GB (64 KB for Lotus Notes).
Remarks:
  • If the message contains special characters or accented characters, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.
  • It is recommended not to exceed 98 characters per row in the text part of the message.. If an row exceeds 998 characters, the message may be considered spam..
MessageIDCharacter stringUnique email identifier. This identifier remains constant for the entire email lifetime. This identifier is used to follow a conversation.
When sending an email, this variable specifies the email identifier. If this variable corresponds to an empty string, the identifier will be given by the server. The application that generates the identifier must check whether this identifier is unique.
When receiving an email, this variable specifies the email identifier.
This identifier must have the following format: <Identifier@domain>. For example: 1@192.168.2.210
WINDEVWEBDEV - Código Servidor This property is not supported in Lotus Notes.

WINDEVWEBDEV - Código Servidor This property is not supported by Outlook in Windows.
OutBooleanSpecifies whether a message was read on the server:
  • False if the message was read.
  • True if the message was not read.
PlainTextCharacter stringPlain text of message. This variable is available for the incoming emails only.
PriorityInteger constantType of priority for the email. The possible values are as follows:
  • emailLowPriority: used for the really non-urgent emails.
  • emailHighPriority: used for the urgent emails.
  • emailNormalPriority (Default value): used for the non-urgent emails.
ReceiveDateCharacter string or DateTime variableDate when the message was received.
RecipientArray of character stringsContains the addresses of main recipients. The number of recipients is limited to 20.
This limit can be exceeded in SMTP mode. However, some servers do not support the emails with an important number of recipients.
ReferenceCharacter stringUnique identifier of one or more reference emails linked to the current conversation.
WINDEVWEBDEV - Código Servidor This property is not supported in Lotus Notes.
WINDEVWEBDEV - Código Servidor This property is not supported by Outlook in Windows.
Versiones 24 y posteriores
ReturnAddressError
Character stringReturn address if an error occurred. This address is managed by the POP3, IMAP and SMTP protocols. For more details, see Correspondence between the properties and the RFC standard.
Remark: If the address contains special characters or accented characters, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.
AndroidWidget Android Not available.
ReturnReceiptBooleanOutbound, used to request a delivery receipt from the recipient (True). The recipient does not necessarily have to send a delivery receipt.
Inbound, used to find out whether a delivery receipt was requested by the sender (True) or no (False). If a read receipt is requested, it has priority over the delivery receipt.
This property is set to False by default.
WINDEVWEBDEV - Código Servidor This property is not supported by Outlook in Windows.
SenderCharacter stringSender's address. This address must be a unique, valid email address. For more details, see Correspondence between the properties and the RFC standard.
Remark: If the sender contains special characters or accented characters, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.
WINDEVWEBDEV - Código Servidor In Outlook, this variable is ignored. The name of account for the current session is used to fill this variable.
WINDEVWEBDEV - Código Servidor In Lotus, the Lotus login is used if the sender is not specified.
SenderAddressCharacter stringAddress to which the answer to the message will be sent (up to 127 characters). Corresponds to Reply-To. For more details, see Correspondence between the properties and the RFC standard.
Remark: If the address contains special characters or accented characters, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.
WINDEVWEBDEV - Código Servidor In Outlook, this variable is ignored. The name of account for the current session is used to fill this variable.
WINDEVWEBDEV - Código Servidor In Lotus, the Lotus login is used if the sender is not specified.
SensitivityInteger constantType of confidentiality for the email. The possible values are as follows:
  • emailCompanyConfidential: Used for the in-house emails for example.
  • emailNoSensitivity (Default value): No confidentiality.
  • emailPersonal: Used for the personal emails for example.
  • emailPrivate: Used for the private emails for example.
This property is not supported in Lotus Notes.
SignatureInteger constantStatus of email signature:
  • certificateExpired: Valid signature but expired certificate.
  • certificateInvalid: Invalid signature or certificate.
  • certificateUntrusted: Valid signature but untrusted certificate root.
  • certificateOK: Trusted signature and certificate.
This property is read-only.
LinuxUniversal Windows 10 AppAndroidWidget Android iPhone/iPad This property is not available.
SourceCharacter stringContains the source of incoming message (subject, sender, recipient, content, ...).
WINDEVWEBDEV - Código Servidor This property is not supported by Outlook in Windows.
SubjectCharacter stringMessage subject.
Remark: If the subject contains special characters or accented characters, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.

Remark: You can use non-Latin characters in the following properties: Subject, Message, Category, SenderAddress, Sender, ID. In this case, use the constant emailOptionEncodeHeader when the message is sent by EmailSendMessage.

Correspondence between the properties and the RFC standard

Version 23 and earlier
From version 24
EnvoiReceptionEnvoiReception
From Sender propertyPopulates the Sender property.Sender propertyPopulates the Sender property.
Reply-ToSenderAddress propertyPopulates the SenderAddress property.SenderAddress propertyPopulates the SenderAddress property.
Return-PathSenderAddress propertyPopulates the SenderAddress property if "Reply-To" is empty.ReturnAddressError propertyPopulates the ReturnAddressError property.
Return-Receipt-To (ReturnReceipt)SenderAddress if specified, Sender property otherwise.Sets the ReturnReceipt property to True if the received value is not empty.SenderAddress if specified, Sender property otherwise. Sets the ReturnReceipt property to True if the received value is not empty.
Disposition-Notification-To (DispositionNotification)SenderAddress if specified, Sender property otherwise. Sets the DispositionNotification property to True if the received value is not empty.SenderAddress if specified, Sender property otherwise. Sets the DispositionNotification property to True if the received value is not empty.

WLanguage functions

The following functions can be used to handle Email variables:
EmailBuildSourceGenera el código fuente del mensaje de correo electrónico que se enviará desde los Variable s en la estructura Email o en un Email Variable.
EmailChangeStatusCambia el estado de una Email en un servidor de mensajería.
EmailCopyCopia una Email encontrada en un directorio a otro directorio de un servidor IMAP.
EmailDeleteMessageBorra el Email actual utilizando el protocolo actual (POP3, IMAP, MS Exchange, Lotus Notes o Outlook).
EmailGetIndicatorRecupera los indicadores definidos en una sesión de Email de IMAP.
EmailImportHTMLImporta, en la estructura del correo electrónico o en un correo Variable, el contenido de un archivo HTML para enviarlo por Email.
EmailImportSourceRellena un Email Variable utilizando el contenido de su Source Property o los diferentes Variable s de la estructura del email utilizando el contenido del Email.Source Variable.
EmailLoadAttachmentAñade un archivo adjunto a una Email.
EmailReadFirstLee el primer Email entrante según el protocolo utilizado (POP3 o IMAP, MS Exchange, Lotus Notes o Outlook).
EmailReadFirstHeaderLee la cabecera del primer Email entrante según el protocolo utilizado (POP3 o IMAP, Lotus Notes o Outlook).
EmailReadLastLee el último Email entrante según el protocolo utilizado (POP3 o IMAP, MS Exchange, Lotus Notes o Outlook).
EmailReadLastHeaderLee la cabecera del último Email entrante según el protocolo utilizado (POP3 o IMAP, Lotus Notes o Outlook).
EmailReadMessageLee un mensaje entrante de acuerdo con el protocolo utilizado (POP3 o IMAP, Lotus Notes o Outlook).
EmailReadMessage HeaderLee la cabecera de un Email entrante según el protocolo utilizado (POP3 o IMAP, Lotus Notes o Outlook).
EmailReadNextLee la Email entrante encontrada después de la Email actual según el protocolo (POP3 o IMAP, MS Exchange, Lotus Notes o Outlook).
EmailReadNextHeaderLee la cabecera del Email encontrado después del Email actual según el protocolo utilizado (POP3 o IMAP, Lotus Notes o Outlook).
EmailReadPreviousLee el Email encontrado antes del Email actual según el protocolo utilizado (POP3 o IMAP, MS Exchange, Lotus Notes o Outlook).
EmailReadPreviousHeaderLee la cabecera del Email encontrado antes del Email actual según el protocolo utilizado (POP3 o IMAP, Lotus Notes o Outlook).
EmailResetRestablece todos los Variable s de la estructura del correo electrónico o todos los Variable s de un correo electrónico Variable.
EmailSeekFirstEncuentra uno o más correos electrónicos según los criterios especificados en el software de mensajería (Outlook, software de mensajería que utiliza el protocolo IMAP, ....).
EmailSeekFirstNotesBusca uno o más correos electrónicos de acuerdo con los criterios especificados, en una base de datos Lotus Notes o Domino local o remota.
EmailSendMessageEnvía un Email utilizando un protocolo determinado (SMTP, MS Exchange, Lotus Notes, Outlook).
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
WEBDEV EMAIL
// btn_enviar ( popup)(server) // SMTP
MINHA_SESSAO is emailSMTPSession
MINHA_SESSAO..ServerAddress="smtpserver"
MINHA_SESSAO..Name="nome_usuario"
MINHA_SESSAO..Password="senha"
IF EmailStartSession(MINHA_SESSAO)=False THEN
ToastDisplay("smtp com erro",toastLong,vaMiddle,haCenter,ErrorInfo())
RETURN
END
//EMAIL
EMAIL_DADOS is Email
EMAIL_DADOS..Sender=EDT_Remetente
EMAIL_DADOS..Subject=EDT_Assunto
EMAIL_DADOS..HTML=EDT_HTML
EMAIL_DADOS..Message=HTMLToText(EDT_HTML)
EMAIL_DADOS..Recipient[1]=EDT_Destinatario
// ENVIAR EMAIL
IF EmailSendMessage(MINHA_SESSAO,EMAIL_DADOS)=False THEN
ToastDisplay("ERRO MENSAGEM",ErrorInfo())
ELSE
ToastDisplay("MENSAGEM ENVIADA COM SUCESSO")
END
// FECHAR SESSAO
EmailCloseSession(MINHA_SESSAO)
amarildo
15 10 2020
Exemplo ok
PROCEDURE SendMensagem()

// Start an SMTP session
MySession is an emailSMTPSession
MySession..ServerAddress = "smtp.gmail.com"
MySession..Name = "adrianoboller@gmail.com"
MySession..Password = "senhasecreta"
MySession..Port = "587"
MySession..Asynchronous = True
IF EmailStartSession(MySession) = True

// Build an email
MyMessage is an Email
MyMessage..Sender = EDT_E_Mail
Add(MyMessage..Recipient, "adrianoboller@gmail.com")
MyMessage..Subject = EDT_Assunto
MyMessage..Message = EDT_Nome + " " + EDT_Telefone + " " + EDT_E_Mail + " " + EDT_Mensagem

// Send the message
IF EmailSendMessage(MySession, MyMessage) = True

ToastDisplay("E-mail enviado com sucesso!")

PAGE_Contato..Plane = 1

ELSE

ToastDisplay("Erro ao tentar enviar o e-mail!")

END

ELSE

ToastDisplay("Erro ao tentar enviar o e-mail!")

END
BOLLER
28 09 2018
ERRO CERTIFICACAO ARRUMADO
EmailConfigure(emailParameterMode,1)
// ESSA CONFIGURACAO ACIMA ARRUMA ERRO CERTIFICACAO
EmailSetTimeOut(30)
HourGlass()
n_email_sessao is boolean=EmailStartSMTPSession(EDT_USUARIO,EDT_SENHA,EDT_SERVIDOR_SMTP,EDT_porta,False,emailOptionSecuredTLS)
IF n_email_sessao=True THEN
_minha_mensagem is an Email // est un Email
_minha_mensagem..Sender=EDT_EmailSender
Add(_minha_mensagem..Recipient, EDT_destinatario)
_minha_mensagem..Subject = EDT_ASSUNTO
_minha_mensagem..Message = EDT_MENSAGEM
_minha_mensagem..SenderAddress = EDT_EmailSender
_minha_mensagem..ReturnReceipt = True
EmailLoadAttachment(_minha_mensagem,EDT_anexo)
IF EmailSendMessage(EDT_USUARIO, _minha_mensagem) = False THEN
Info("Erro Mandar Mesnagem:"+CR+ErrorInfo())
END
EmailCloseSession(EDT_USUARIO)
END
HourGlass(False)
// blog com video e exemplo
// http://windevdesenvolvimento.blogspot.com.br/2017/10/aula-1277-email-3-erro-certificacao.html
// https://www.youtube.com/watch?v=LxqfFegkGqo

De matos
29 10 2017

Última modificación: 21/11/2023

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