Numerous requirements mean magic mouths and programmed illusions cannot use the Book of Vile Darkness
The book of Vile Darkness requires attunement and benefits only the attuned
The "Attunement" section of the Dungeon Master's Guide (starts on page 136) states:
[...] Without becoming attuned to an item that requires attunement, a creature gains only its nonmagical benefits, unless its description states otherwise. [...]
Because the Book of Vile Darkness requires attunement and doesn't state that the Dark Speech can be used without attunement, attunement is required to use Dark Speech in the first place. Neither a magic mouth nor a programmed illusion would be attuned to the Book and so they could not benefit from its properties.
Furthermore, Dark Speech requires you (the attuned) both to be carrying the Book and to use an action
Dark Speech states:
[...] While you carry the Book of Vile Darkness and are attuned to it, you can use an action to recite words from its pages in a foul language known as Dark Speech. Each time you do so, you take 1d12 psychic damage, and each non-evil creature within 15 feet of you takes 3d6 psychic damage. [...]
This requires many things:
- You carry the Book
- You are attuned to it
- You (the attuned) use an action
The damage simply does not occur unless all of these are satisfied. This is because the damage only happens "each time you do so [use the action granted by the Book]" A magic mouth or programmed illusion cannot satisfy any of these conditions, let alone all three (they cannot carry the Book, nor attune to it, nor can they use the action that Dark Speech requires). Therefore, they cannot use Dark Speech.