“La lettre” is a feminine singular direct object → use “la.”
“Au proviseur” is an indirect object referring to a person → use “lui.”
The correct pronoun order is: la lui.
In passé composé, the past participle “envoyé” agrees with the direct object “la” when placed before the verb.
So we add an extra “e” to get: envoyée.
Full sentence: David la lui a envoy´ee.