The sentence, To whom shall I give this letter, is grammatically correct; but in ordinary usage we use the form, Who shall I give this letter to?
While the rule calls for the object form of the relative pronoun after a preposition—so that the use of to whom is grammatically correct—in common usage we use the subject form of the pronoun when it is used so far away from the preposition which governs it. So we find this use common. For example, instead of saying, For whom is this letter? we say, Who is this letter for?
315. In poetry also, we often find the object coming before the preposition. For example:
"The interlacing boughs between
Shadows dark and sunlight sheen,
Alternate, come and go."
Boughs is here the object of the preposition between, but in this poetic expression the object is placed before the preposition. Note also in the following:
"The unseen mermaid's pearly song,
Comes bubbling up the weeds among."
"Forever panting and forever young,