Look at the following sentences:
(a) Past simple: I lived in Florence for five years ... but I do not
live there anymore.
(b) Present perfect: I have lived in Florence for five years ... and I
still live there now.
(c) Past simple: I broke my glasses ... but it does not matter. I
repaired them.
(d) Present perfect: I have broken my glasses ... and so I can't see
properly now.
You probably learned the difference between (a) and (b) years ago: that one of differences between past simple and past perfect is the 'time' of the verb, i.e. when it happened. The difference between (c) and (d) is harder to understand.
In (c) and (d), 'time', i.e. when the verb happened, is not really what separates the two sentences; it is possible that both (c) and (d) happened last month, this morning, or one second ago. What is important is that the event in (d) is considered more relevant to the situation now than the event in (c), which is why it is given in the present perfect.
That said, let us consider the first sentence: "I sent you a letter a few days ago, I was wondering if you have received it." Here person who ask the question would seem interested to talk about what he or she did wrote in the letter. (Lett. 'd' in my example.)
While, in the latter example, "I sent you a letter a few days ago, I was wondering if you received it," person who ask the question wants to make sure himself or herself that the letter is being received. (Lett. 'c' in my example.)