Both sentences are correct. I am sure that you can also say them with 'for whom' and 'to whom' at the beginning instead, but I am certain these phrasings are obsolete now. I think it was Victorian literature or the like that I have seen them in.
Nowadays, people don't tend to say or write whom though. It is correct to use whom (the dative case) here, but it is usually considered old and formal now - i.e. it is generally just old people that use it or someone writing a very formal letter - but even then they might just use who. Who is used in all instances (i.e. all cases - with the exception of the genitive) by the vast majority of modern speakers.
I would, however, suggest that you use whom in formal situations such as any university work. Otherwise, if you use whom in general or informal situations you will probably just sound dated - which people will pick up on as being odd.
Just to clarify, the sentences with the modern changes would be : 1. Who did she buy flowers for?
2. Who did I send a letter to?