James Foley used an unconventional method to send a final message to his family while he was held captive, Vanity Fair reported Monday. Since it was impossible for him to get a letter past the guards, he had a fellow prisoner commit it to memory. Foley was not allowed to send letters like other hostages because he was American, the Foley family’s priest of 30 years, Father Marc Montminy, told the Daily Mail. So he dictated his message to a fellow captive, Danish photojournalist Daniel Rye Ottosen. Ottosen memorized the message, and when he was released in June, he called Foley’s family.

“I have had weak and strong days," Foley wrote. "We are so grateful when anyone is freed; but of course, yearn for our own freedom.”

"I remember so many great family times that take me away from this prison. Dreams of family and friends take me away and happiness fills my heart," Foley wrote.

Foley said he was in a cell with 17 prisoners. They kept busy with inventive games, "endless long conversations about movies, trivia, sports," and "teaching each other." He continued: “The games and teaching each other have helped the time pass. They have been a huge help.”

The final paragraphs are heartbreaking messages to his siblings and grandmother. He said how proud he was of his siblings and told his grandmother to continue to dance. “Grammy, please take your medicine,” he said. “I plan to take you out to Margarita’s when I get home. Stay strong because I am going to need your help to reclaim my life.”

The full letter can be read on Facebook. It was posted to the “Free James Foley” page. Thousands of people “liked” and shared the message.

Foley was held captive and beheaded by the Islamic State, formerly known as the Islamic State in Iraq and Syria, or ISIS. His killer has apparently been identified by British intelligence agencies.

Follow me on twitter @mariamzzarella