So, I'm still writing this dialup/mailgrab/whatever php script. Well, I'm rewriting it because the original version was a nasty cruft of hacks.
It's basically driven by a state machine with four states:
However, the FETCHMAIL state needs to send mail, fetch mail and send mail again, necessitating a state machine for that, with three states:
My question: Should I leave this as a nested state machine, expand it out into three mail-handling states in the main state machine or drop all the mail stuff into a shell script instead of doing it in the php?