ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Managing emails
  • Properties specific to emailAttach variables
  • Functions that use an emailAttach variable
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The emailAttach type is used to handle an attachment. You can define and change the characteristics of this attachment using different WLanguage properties.
This type of variable is used by Email variables.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Attachement d'une pièce jointe à un email

monEmail is Email
...
monAttache is emailAttach
sFichier is string

// Sélection du fichier à joindre
sFichier = fSelect("", "", "Sélectionnez le document PDF à joindre...", ...
		"Documents PDF (*.PDF)" + TAB + "*.pdf", "*.pdf")

// Construction de la variable emailAttache
monAttache.Name = fExtractPath(sFichier, fFile + fExtension)
monAttache.Content = fLoadBuffer(sFichier)
monAttache.ContentType = fContentType(sFichier)
monAttache.ContentDescription = "Un document"

// Ajout de la pièce jointe
Add(monEmail.Attach, monAttache)
// Seconde méthode avec EmailChargeFichierAttaché

MonFichierEmailSourceTemp is string 
MonFichierEmailSourceTemp = CompleteDir(fExeDir()) + "EmailSource.eml"
IF fFileExist(MonFichierEmailSourceTemp) THEN 
	fDelete(MonFichierEmailSourceTemp)
END
EmailReset(MonSourceEmail)

// Construction de l'email dans un fichier EML (source de l'email)
// LISTE_Attachement contient la liste de mes pièces jointes
Add(MonSourceEmail.Recipient, SAI_Destinataire)
FOR EACH ROW OF LISTE_Attachement
	EmailLoadAttachment(MonSourceEmail, ...
		LISTE_Attachement.ValeurAffichée)
END

MonSourceEmail.Sender = "mon_adresse@test.com"
MonSourceEmail.Subject = "Mon sujet"
MonSourceEmail.Message = HTMLToText(SAI_EMAIL_HTML)
EmailImportHTML(MonSourceEmail, SAI_EMAIL, CompleteDir(fExeDir()))
EmailBuildSource(MonSourceEmail)
Properties

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.
Note: If the attachment is filled in manually, don't forget to specify the Nom property, otherwise the image will not be transmitted in the email.. Example:
oEmail.Attach[1].Contenu = ...
	fLoadBuffer(fDataDir() + ...
	 ["\"] + "Email\" + sLogoSociété)
oEmail.Attach[1].ContentType = "image/gif"
oEmail.Attach[1].Nom = "logo.gif"
IdentifierCharacter stringIdentifier of attached file included in an HTML message.
NameCharacter stringName of attached file.

Note: Non-Latin characters can be used in the Name and ContentDescriptionproperties.
Remarks

Functions that use 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: 09/20/2024

Send a report | Local help