The man accused of sending threatening letters packed with a mysterious white powder to President Trump’s sons and a Democratic U.S. Senator pleaded guilty in a Boston federal court Wednesday.

Daniel Frisiello, of Beverly, Massachusetts, was arrested earlier this year after reportedly sending a February letter filled with white powder to Donald Trump Jr.

Trump Jr.'s now-estranged wife, Vanessa Trump, opened the letter and was briefly hospitalized after being exposed to the powder. Vanessa reportedly began coughing and feeling nauseous, however, she was soon cleared by doctors and the substance in the letter was found to be cornstarch.

Authorities said the letter included a threatening note that read: “You are an awful, awful person. I am surprised that your father lets you speak on TV. You the family idiot, Eric, looks smart.”

“This is the reason why people hate you, so you are getting what you deserve,” the message said.

The 25-year-old Frisiello, who wore a dark suit, looked down in front of him and put his hand to his mouth as the prosecutor read to the court some of Frisiello's letters filled with profanity and slurs.

Assistant U.S. Attorney Scott Garland said Frisiello was a "prolific letter writer" who wrote to public figures and celebrities to share his ideas and request autographs. But he also had a "darker side," Garland said.

Investigators said Frisiello also sent letters to Trump's other son, Eric Trump, and U.S. Sen. Debbie Stabenow (D-Mich.). Officials were able to track Frisiello down after examining a “glitter bomb” he allegedly sent to Michelle Dauber, a Stanford University law professor. Dauber supported the effort to recall a judge who made national headlines when he sentenced a college student to six months for a sexual assault.

Authorities said the font used in the letter sent to Dauber matched the lettering in the notes filled with white powder.

Frisiello’s Facebook page and other public information also appeared to suggest a strong hostility toward the Trump family and Republicans, authorities said.

Frisiello did, however, also post bizarre rants against some Democrats, including Stabenow. Stabenow allegedly drew Frisiello's ire after she said she was disappointed a father was prevented from punching Larry Nassar, the disgraced former U.S. gymnastics doctor who was convicted of molesting more than 250 women and girls.

Frisiello's attorney has said Frisiello has some unidentified "issues" and has been on medication his entire life.

Frisiello, who has been out of jail since March, was allowed Wednesday to return to his home, where he's been confined with certain restrictions. He's prohibited from sending anything in the mail. He'll be sentenced in January and has agreed not to appeal his sentence if it's 7 1/4 years or less.

The Associated Press contributed to this report.