ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Managing emails
  • Properties specific to emailAttach variables
  • Functions that handle an emailAttach variable
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The emailAttach type is used to handle an attachment. The characteristics of this attachment can be defined and modified using different WLanguage properties.
This type of variable is used by Email variables.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Attach an attachment to an email
 
myEmail is Email
...
myAttach is emailAttach
sFile is string
 
// Select the file to attach
sFile = fSelect("", "", "Select the PDF document to attach...", ...
"PDF documents (*.PDF)" + TAB + "*.pdf", "*.pdf")
 
// Build the emailAttach variable
myAttach.Name = fExtractPath(sFile, fFile + fExtension)
myAttach.Content = fLoadBuffer(sFile)
myAttach.ContentType = fContentType(sFile)
myAttach.ContentDescription="A document"
 
// Add the attachment
Add(myEmail.Attach, myAttach)
// Second method with EmailLoadAttachment
 
MyTempSourceEmailFile is string
MyTempSourceEmailFile = CompleteDir(fExeDir()) + "EmailSource.eml"
IF fFileExist(MyTempSourceEmailFile) THEN
fDelete(MyTempSourceEmailFile)
END
EmailReset(MyEmailSource)
 
// Build the email in an EML file (email source)
// LIST_Attachment contains the list of my attachments
Add(MyEmailSource.Recipient, EDT_Recipient)
FOR EACH ROW OF LIST_Attachment
EmailLoadAttachment (MyEmailSource, ...
LIST_Attachment.DisplayedValue)
END
 
MyEmailSource.Sender = "my_address@test.com"
MyEmailSource.Subject = "My subject"
MyEmailSource.Message = HTMLToText(EDT_EMAIL_HTML)
EmailImportHTML(MyEmailSource, EDT_EMAIL, CompleteDir(fExeDir()))
EmailBuildSource(MyEmailSource)
Remarks

Properties specific to emailAttach variables

The following properties can be used to handle emailAttach variables:
Property nameType used Effect
ContentDescriptionCharacter stringText used to describe the attachment content.
ContentTypeCharacter stringType of file according to the MIME standard (Multipurpose Internet Mail Extensions). The "Content Type" indicates to the messaging software how the attachment must be interpreted.
ContentBufferContent of attachment.
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].Content = ...
fLoadBuffer(fDataDir() + ...
 ["\"] + "Email\" + sCompanyLogo)
oEmail.Attach[1].ContentType = "image/gif"
oEmail.Attach[1].Name = "logo.gif"
IdentifierCharacter stringIdentifier of attached file included in an HTML message.
NameCharacter stringName of attached file.

Remark: You can use non-Latin characters in the Name and ContentDescription properties.

Functions that handle an emailAttach variable

The following functions can be used to handle emailAttach variables:
EmailLoadAttachmentAdds an attached file to an email.
EmailSaveAttachmentCopies the attachment of current email onto the user computer (locally).
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 version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help