Solution (due to Amit Nangia).
The number of nonnegative integer solutions to
(1) a+b+c+d+e+f = 12
is (12+5)C5 = 17C5. Among these solutions, we want to exclude the ones with any of a, b, c, d, e, f >= 10. If we assume that a >= 10, then we set a' = a-10 in (1) to obtain
(2) a'+b+c+d+e+f = 2.
The number of nonnegative integer solutions to (2), or that to (1) with a >= 10, is (2+5)C5 = 7C5. Therefore the number of nonnegative integer solutions to (1) with any of a, b, c, d, e, or f >= 0 is 6*7C5. It follows that the number of nonnegative integer solutions to (1) with a, b, c, d, e, f <= 9 is 17C5-6*7C5 = 6062. By letting a, b, c, d, e, f be the digits of an integer between 1 and 10^6, it is easy to see that the number of integers which lie between 1 and 10^6 and which have the sum of the digits equal to 12 is the same result, namely 6062.