A postman has to deliver five letters to five different houses. Mischievously, he posts one letter through each door without looking to see if it is the correct address. In how many different ways could he do this so that exactly two of the five houses receive the correct letters?

To solve this problem, we need to determine the number of ways to deliver five letters to five different houses such that exactly two of the houses receive the correct letters. This is a classic problem of derangements with a constraint.

1. **Choose the two houses that will receive the correct letters:**
   We can choose 2 houses out of 5 to receive the correct letters in:
   \[
   \binom{5}{2} = \frac{5!}{2!(5-2)!} = \frac{5 \times 4}{2 \times 1} = 10
   \]

2. **Derange the remaining three letters:**
   For the remaining three letters, none of them should go to their correct houses. This is a derangement problem for 3 items. The number of derangements (denoted as \( !n \)) of 3 items is given by:
   \[
   !3 = 2
   \]
   This can be calculated using the formula for derangements:
   \[
   !n = n! \sum_{i=0}^{n} \frac{(-1)^i}{i!}
   \]
   For \( n = 3 \):
   \[
   !3 = 3! \left( \frac{(-1)^0}{0!} + \frac{(-1)^1}{1!} + \frac{(-1)^2}{2!} + \frac{(-1)^3}{3!} \right) = 6 \left( 1 - 1 + \frac{1}{2} - \frac{1}{6} \right) = 6 \left( \frac{1}{2} - \frac{1}{6} \right) = 6 \times \frac{1}{3} = 2
   \]

3. **Combine the results:**
   The total number of ways to deliver the letters such that exactly two houses receive the correct letters is the product of the number of ways to choose the two houses and the number of derangements of the remaining three letters:
   \[
   \binom{5}{2} \times !3 = 10 \times 2 = 20
   \]

The final answer is \(\boxed{20}\).