That evening, the director of the Secret Service sent Kelly a congratulatory email with a flash of sarcasm.

"Congratulations, I think," wrote retired Marine Corps General Randolph "Tex" Alles.

The email from the man who leads the agency charged with protecting the president was obtained by BuzzFeed News in response to a Freedom of Information Act lawsuit, revealing his thoughts on Kelly's appointment.

At the time, the White House was contending with a staff shakeup that saw the departure of chief of staff Reince Priebus, press secretary Sean Spicer's abrupt resignation, and combative hedge fund executive Anthony Scaramucci hired as communications director.

In a statement, the Secret Service said Alles served in the Marine Corps with Kelly and they "developed professional respect for one another as well as a friendship."

"As any person who has ever been selected to serve and command in challenging positions understand — congratulations are in order — those who convey the message often acknowledge the magnitude and difficulty of the new assignment and therefore extend a caveat."