If you are planning to convert a carboxylic acid into the corresponding methyl ester, chances are your two main plans will be the Fischer esterification or the reaction with a methyl electrophile. While the esterification is one of the easiest reactions to perform, you will need strong acidic conditions, and not many organic functionalities will stand it. Otherwise, if you do not mind to use slightly basic reaction conditions, the use of methyl iodide or dimethyl sulfate (or even worse, diazomethane) generally does the job and does it well. The downside, of course, is the notorious toxicity of these bad boys. If not acute, they will methylate anything they find, and if you are not cautious, it may well be your lungs or your DNA (remember these are very volatile species, and dimethyl sulfate was once considered as a chemical weapon, but as I remember it, it was not deadly enough).
A new way to get around this whole toxicity issue is described in one of the last papers from the team of Dr. David J. Gorin (from Smith College, Northampton, MA). Here dimethyl carbonate plays the role of the methylating agent, and the good news are, it is cheap, readily available, the boiling point is quite high (90 °C) and it is fairly harmless compared with methyl iodide and dimethyl sulfate.
The yields are good to excellent (75-99%) and the method is chemoselective. In fact, this methylation does not affect unprotected phenols, so there is no point in worrying about having a product mixture or struggling with protecting group manipulation.
J. Org. Chem. 2013, 78, 11606-11611. link