PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of Email variables
  • Functions
  • Limits
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The Email type is used to handle the email content as well as the associated information. The email characteristics can be defined and modified by several WLanguage properties.
This type replaces and extends the Email structure by giving you the ability to handle several messages at the same time.
Note: See Declaring a variable for more details.
Versions 17 and later
iPhone/iPad This type of variable is now available for the iPhone and iPad applications.
New in version 17
iPhone/iPad This type of variable is now available for the iPhone and iPad applications.
iPhone/iPad This type of variable is now available for the iPhone and iPad applications.
Versions 21 and later
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Versions 22 and later
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
New in version 22
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
Example
// Send an email

// Build the message
MyMessage is Email

// Sender
MyMessage..Sender = sSender

// Recipients
sRecipient_1 is string = "aaa@gmail.com"
sRecipient_2 is string = "bbb@gmail.com"
Add(MyMessage..Recipient, sRecipient_1)
Add(MyMessage..Recipient, sRecipient_2)


// Message content
MyMessage..Subject = EDT_Subject
MyMessage..Message = RTFToText(sNote)
MyMessage..HTML = RTFToHTML(sNote)

// Start an SMTP session
MySession is emailSMTPSession
MySession..ServerAddress = sServer
IF EmailStartSession(MySession) = False THEN RETURN

// Send the message (the emailOptionEncodeHeader constant is used to
// take the accented characters into account)
EmailSendMessage(MySession, MyMessage, emailOptionEncodeHeader)

// Close the session
EmailCloseSession(MySession)
Remarks

Properties specific to the description of Email variables

The following properties can be used to handle an Email variable:
NameType usedEffect
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 return receipt.
This property is set to False by default.
WINDEVWEBDEV - Server code This property is not supported by Outlook in Windows.
SenderAddressCharacter stringAddress of sender.
Note: If the address contains special characters or accented characters, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
WINDEVWEBDEV - Server code In Outlook, this variable is ignored. The name of account for the current session is used to fill this variable.
WINDEVWEBDEV - Server code In Lotus, the Lotus login is used if the sender is not specified.
AttachArray of emailAttachContains the description of attached files.
The number of attached files is unlimited.
See emailAttach for more details.
Note: If the attachment is filled manually, don't forget to specify ..Name otherwise the image will not be transmitted in the email. Example:
oEmail..Attach[1]..Content = fLoadBuffer(fDataDir() +
 ["\"] + "Email\" + sCompanyLogo)
oEmail..Attach[1]..ContentType = "image/gif"
oEmail..Attach[1]..Name = "logo.gif"
CategoryCharacter stringList of keywords associated with the email. The keywords are separated by semicolons.
Note: If one of the keywords contains special characters or accented characters, use the emailOptionEncodeHeader constant 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.
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.
Versions 16 and later
Certificate
New in version 16
Certificate
Certificate
CertificateCertificate used to sign the email (header, content and attachments) before sending it.
Versions 16 and later
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available.
New in version 16
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available.
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available.
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.
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 return receipt.
This property is set to False by default.
WINDEVWEBDEV - Server code This property is not supported in Lotus Notes.
This property is supported by Outlook in Windows and by Outlook in Pocket.
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.
OutBooleanSpecifies whether a message was read on the server:
  • False if the message was read.
  • True if the message was not read.
Versions 19 and later
Header
New in version 19
Header
Header
Array of emailHeaderHeaders of email.
Windows Mobile This property is not available.
SenderCharacter stringAddress to which the answer to the message will be sent (up to 127 characters).
Note: If the sender contains special characters or accented characters, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
WINDEVWEBDEV - Server code In Outlook, this variable is ignored. The name of account for the current session is used to fill this variable.
WINDEVWEBDEV - Server code In Lotus, the Lotus login is used if the sender is not specified.
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).
Note: If the identifier contains special characters or accented characters, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
WINDEVWEBDEV - Server code 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).
Note: If the message contains special characters or accented characters, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
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 - Server code This property is not supported in Lotus Notes.
Windows Mobile This property is supported by Outlook in Pocket.
WINDEVWEBDEV - Server code This property is not supported by Outlook in Windows.
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.
ReferenceCharacter stringUnique identifier of one or more reference emails linked to the current conversation.
WINDEVWEBDEV - Server code This property is not supported in Lotus Notes.
Windows Mobile This property is supported by Outlook in Pocket.
WINDEVWEBDEV - Server code This property is not supported by Outlook in Windows.
Versions 16 and later
Signature
New in version 16
Signature
Signature
Integer 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 available in read-only.
Versions 16 and later
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available.
New in version 16
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available.
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available.
SourceCharacter stringContains the source of incoming message (subject, sender, recipient, content, ...).
SubjectCharacter stringMessage subject.
Note: If the subject contains special characters or accented characters, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
PlainTextCharacter stringPlain text of message. This variable is available for the incoming emails only.

Notes:
  • These properties can be used via one of the following syntaxes:
    • <Variable Name>..<Property Name>
    • <Variable Name>.<Property Name>
  • Versions 17 and later
    You have the ability to use non-Latins characters in the following properties: ..Subject, ..Message, ..Category, ..SenderAddress, ..Sender, ..ID. In this case, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
    New in version 17
    You have the ability to use non-Latins characters in the following properties: ..Subject, ..Message, ..Category, ..SenderAddress, ..Sender, ..ID. In this case, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.
    You have the ability to use non-Latins characters in the following properties: ..Subject, ..Message, ..Category, ..SenderAddress, ..Sender, ..ID. In this case, use the emailOptionEncodeHeader constant when the message is sent by EmailSendMessage.

Functions

The following functions can be used to handle an Email variable:
Versions 12 and later
EmailBuildSource
New in version 12
EmailBuildSource
EmailBuildSource
Generates the source code of outgoing email from the variables currently found in the email structure or in an Email variable].
Versions 15 and later
EmailChangeStatus
New in version 15
EmailChangeStatus
EmailChangeStatus
Changes the status of an email on a messaging server.
Versions 17 and later
EmailCopy
New in version 17
EmailCopy
EmailCopy
Copies an email found in a directory to another directory of an IMAP server.
Versions 09 and later
EmailDeleteMessage
New in version 09
EmailDeleteMessage
EmailDeleteMessage
Used to delete the current email according to the current protocol (POP3, IMAP, MS Exchange, Pocket Outlook, Lotus Notes or Outlook messaging).
Versions 20 and later
EmailGetIndicator
New in version 20
EmailGetIndicator
EmailGetIndicator
Retrieves the indicators defined on an email of IMAP session.
Versions 10 and later
EmailImportHTML
New in version 10
EmailImportHTML
EmailImportHTML
Imports, into the Email structure or into an Email variable, the content of an HTML file in order to send it by email.
Versions 12 and later
EmailImportSource
New in version 12
EmailImportSource
EmailImportSource
Fills an Email variable from the content of its ..Source property or the different variables of the email structure from the content of the Email.Source variable.
Versions 15 and later
EmailLoadAttachment
New in version 15
EmailLoadAttachment
EmailLoadAttachment
Adds an attached file to an email.
Versions 09 and later
EmailReadFirst
New in version 09
EmailReadFirst
EmailReadFirst
Reads the first incoming email according to the protocol used (POP3 or IMAP, MS Exchange, Lotus Notes or Outlook).
Versions 09 and later
EmailReadFirstHeader
New in version 09
EmailReadFirstHeader
EmailReadFirstHeader
Reads the header of the first incoming email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).
Versions 09 and later
EmailReadLast
New in version 09
EmailReadLast
EmailReadLast
Reads the last incoming email according to the protocol used (POP3 or IMAP, MS Exchange, Lotus Notes or Outlook).
Versions 09 and later
EmailReadLastHeader
New in version 09
EmailReadLastHeader
EmailReadLastHeader
Reads the header of last incoming email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).
Versions 09 and later
EmailReadMessage
New in version 09
EmailReadMessage
EmailReadMessage
Reads an incoming according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).
Versions 09 and later
EmailReadMessageHeader
New in version 09
EmailReadMessageHeader
EmailReadMessageHeader
Reads the header of an incoming email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).
Versions 09 and later
EmailReadNext
New in version 09
EmailReadNext
EmailReadNext
Reads the incoming email found after the current email according to the protocol (POP3 or IMAP, MS Exchange, Lotus Notes or Outlook).
Versions 09 and later
EmailReadNextHeader
New in version 09
EmailReadNextHeader
EmailReadNextHeader
Reads the header of the email found after the current email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).
Versions 09 and later
EmailReadPrevious
New in version 09
EmailReadPrevious
EmailReadPrevious
Reads the email found before the current email according to the protocol used (POP3 or IMAP, MS Exchange, Lotus Notes or Outlook).
Versions 09 and later
EmailReadPreviousHeader
New in version 09
EmailReadPreviousHeader
EmailReadPreviousHeader
Reads the header of the email found before the current email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).
Versions 09 and later
EmailReset
New in version 09
EmailReset
EmailReset
Re-initializes all the variables of the email structure or all the variables of an Email variable.
Versions 11 and later
EmailSeekFirst
New in version 11
EmailSeekFirst
EmailSeekFirst
Finds one or more emails according to the criteria specified in the messaging software (Outlook, messaging software using the IMAP protocol, ...).
Versions 11 and later
EmailSeekFirstNotes
New in version 11
EmailSeekFirstNotes
EmailSeekFirstNotes
Seeks one or more emails according to specified criteria, in a local or remote Lotus Notes or Domino database.
Versions 09 and later
EmailSendMessage
New in version 09
EmailSendMessage
EmailSendMessage
Sends an email according to the protocol used (SMTP, MS Exchange, Pocket Outlook, Lotus Notes, Outlook).
AndroidAndroid Widget

Limits

This type of variable is available for the devices equipped with ARM processors. A fatal error occurs if this type of variable is used with devices not equipped with ARM processors (x86, mips, ...). This type of variable is available for the devices equipped with ARM processors or using an ARM emulation. Otherwise (and on the Samsung Galaxy Tab 3 tablet), a fatal error will occur.
Related Examples:
WD Mail Complete examples (WINDEV): WD Mail
[ + ] This application is an email client developed in WINDEV. It is based on the Email objects.
This email client is used to retrieve and send emails by using the POP, IMAP and SMTP protocols.
You have the ability to apply filters to the incoming emails.

The application can also be used to manage several email accounts. The writing of an email is based on the HTML edit control.
Minimum required version
  • Version 15
This page is also available for…
Comments
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
Sep. 28 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
Oct. 29 2017