E.g. here is an email I just sent:
Hello X,
Okay I see - thanks very much for all the code! I'll definitely have to take some time to study it before I can ask any questions. :)
Also - thanks for your explanation on X [insert how X's explanation on X has helped me with something]
Thanks very much! Y
One thing I've thought of doing: merging the "thanks" into "thanks very much for the code and explanation!" But the issue is that I want to make separate comments for the code and then for the explanation, and it's easier to do that when I separate out the "thanks" (and then repeat it more, which then sounds even more repetitive)