What is the preferred way to write this type of sentence?

Beware that the one with the brackets is an incorrect way of "saying" (typing) a sentence.

There are 2 options here. Option 1:

Sally the mayor's daughter donated to the Salvation Army yesterday.

In this situation, "the mayor's daughter" part defines exactly which Sally you are talking about. Therefore it's implied that there is more than one Sally and you are specifying the correct one.

Option 2:

Sally, the mayor's daughter, donated to the Salvation Army yesterday.

In this situation, "the mayor's daughter" part simply adds an additional info about Sally, which isn't required for the sentence to work, because there is only one Sally, or the specific one is already specified by any previous info in the text.