The noun envoy has two main definitions: (1) a representative of a government who is sent on a diplomatic mission, and (2) a short closing stanza in certain forms of poetry (or an analogous closing section in any work of art). Envoi is an alternative spelling of the second sense of envoy. Though most major dictionaries list the literary definition under envoy, poets, critics, and art-literate people in general prefer envoi for this sense. Envoy is reserved for the diplomacy-related sense.
The use of envoi in relation to poetry is rare outside poetry circles, but critics of other art forms sometimes use it in place of terms such as epilogue and coda—for example:
Marshall begins and ends her book with the Hawthorne wedding and, except for a brief envoi, leaves her three subjects in mid-life. [Washington Post]
But the second of this long-running series, imbued with the dynamism and rhythmic complexity of the Rite of Spring, made for an exhilarating envoi. [London Evening Standard]
Both words are conventionally pronounced in the French style—AHN-voy—but the Anglicized EHN-voy has gained ground and is fine.

