‘John uses a program which sends messages, automatically chooses recipients and edits the text, and detects spams.’
If I wanted that sentence to be euphonic (pleasing to the ear and easier to pronounce), I would rewrite it to this: ‘John uses a program which detects spams, sends messages, and automatically chooses recipients and edits the text.’ If it sounds more pleasing now, it’s because I’ve reordered the items according to the number of syllables in each item.
A related subject is Phonemics which should not be confused with Euphonics. A phoneme may consist of several phonetically distinct articulations, which are regarded as identical by native speakers. The phonemes of a certain language changes and/or might be changed for clarity. In detail, it’s the substitution of an articulation for another without changing its meaning.