She seemed to have been surprised by the letter.

Literal

She [topic-は] that letter [trigger-に] surprised [seems-ようだった].

~ようだった is the past-tense form of ~ようだ ('seems/appears'), used here to describe an inferred past state: 'she seemed [in retrospect] to have been surprised.' The に marks the trigger of the emotion — the standard particle for the source of an emotional reaction (に驚く, に感動する, に感心する all share this pattern). The whole is third-person observation about her reaction, the kind of sentence a narrator or witness uses to convey indirect knowledge of someone's internal state.