You cannot easily designate MailText and Anhang because you cannot declare another object with a compatible type. This is because you used the dynamic inline array type in your write declaration. You really need to use a type that you can name. To illustrate this a little better, consider the following:
X: array of Integer; Y: array of Integer;
Now X and Y are of different types and X := Y does not compile.
Another problem is your open array parameter. An open array parameter is an assignment that is not compatible with anything. You can copy element by element, but you cannot assign an array at a time.
The best way out of this is to declare the field as follows:
MailText, Anhang: TArray<string>;
And change the parameters of the open array in the function in the same way as for this type.
Then you need to decide if you want to copy the link or array:
MailText := aMailText; // copy reference, or MailText := Copy(aMailText); // copy array
source share