I thought the letter had been sent to my friend.
要用被动语态,而且是send 的 双宾语用法:send sb sth send sth to sb( sth be sent to sb)
其实可以跟简单一点 The letter should have been sent to my friend.或者用The letter was supposed to have been sent to my friend.
语法的话,过去完成时和现在完成时没有太大关系.过去完成时强调过去的过去,而现在完成时更注重已经完成.