PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Properties specific to the description of 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
emailAttach (Type of variable)
In french: emailAttache (Type de variable)
The emailAttach type is used to handle an attachment. The characteristics of this attachment can be defined and modified by several WLanguage properties.
This type of variable is used by the Email variables.
Note: See Declaring a variable for more details.
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.
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 = "application/pdf"
myAttach..ContentDescription = "A PDF 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 the description of emailAttach variables

The following properties can be used to handle an emailAttach variable:
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.
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"
IdentifierCharacter stringIdentifier of attached file included in an HTML message.
NameCharacter stringName of attached file.


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 ..Name and ..ContentDescription properties.
    New in version 17
    You have the ability to use non-Latins characters in the ..Name and ..ContentDescription properties.
    You have the ability to use non-Latins characters in the ..Name and ..ContentDescription properties.

Functions that handle an emailAttach variable

The following functions can be used to handle an emailAttach variable:
Versions 15 and later
EmailLoadAttachment
New in version 15
EmailLoadAttachment
EmailLoadAttachment
Adds an attached file to an email.
Versions 09 and later
EmailSaveAttachment
New in version 09
EmailSaveAttachment
EmailSaveAttachment
Copies 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