Rule 2.9 American Bar Association
(A) A judge shall not initiate, permit, or consider ex parte communications, or consider other communications made to the judge outside the presence of the parties or their lawyers
By the way Rule 2.10 prohibits judges from commenting outside the court room on matters before him, which includes writing letters.
Maybe the judge will ignore these rules given these were such "well written letters". In fact I'm told judges do it all the time, which makes you wonder why so many aren't disbarred.