Official Content

Returns the paths to the files attached in a mail message and contains methods to add or remove attachments.

Syntax

&MailMessageVariableName.Attachments

Type Returned:
StringCollection

Where:
MailMessageVariableName
    Is a variable based on the MailMessage data type.

Scope

Extended Data Types: MailMessage
Generators: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

When you receive a mail, the Attachment property contains the paths to the files attached to it.

If you need to add attachments to a mail message that you want to send, you can use the Add method as shown:

&MailMessageVariableName.Attachments.Add('path')

where:

'path'
    Is the path where the file to be attached is located (including the file name and extension).

Notes:

  • If a complete route is not specified when sending a message, the attached files will be searched for in the directory specified by the AttachDir property.
  • To provide compatibility between the UNIX and Windows environments, you can use either the slash (/) or the backslash (\) as directory delimiters in the route of the attached files.

Sample

&MailMessage.Attachments.Add("C:\fullgx\kbaux\image001.jpg")
&MailMessage.Attachments.Add("C:\fullgx\kbaux\promptX.gif")
&MailMessage.Attachments.Add("C:\fullgx\kbaux\TempFile_1.txt")

See Also

AttachDir Property
MailMessage data type
StringCollection Data Type






Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant