Create a script that mails admin (if ZFS_EMAIL is set) if a vdev fails probe.
Create a script to notify admin(s) that a vdev have been removed.
Make sure we detect/find a device which may (or may not) have '-part?' in it's name.
If email is configured, send a mail after replace is complete.
Take both success and failure of a replace into account when sending email.
Don't close STDERR. This only works when zed runs in the forground.
That might be enough to iron out any problems in the script.
Fix 'cat | mail' pipe.
Kept getting:

/etc/zfs/zed.d/scrub.finish-email.sh: 15: /etc/zfs/zed.d/scrub.finish-email.sh: A: not found
/etc/zfs/zed.d/scrub.finish-email.sh: 17: /etc/zfs/zed.d/scrub.finish-email.sh: eid:: not found
/etc/zfs/zed.d/scrub.finish-email.sh: 18: /etc/zfs/zed.d/scrub.finish-email.sh: host:: not found
/etc/zfs/zed.d/scrub.finish-email.sh: 19: /etc/zfs/zed.d/scrub.finish-email.sh: pool:: not found
/etc/zfs/zed.d/scrub.finish-email.sh: 20: /etc/zfs/zed.d/scrub.finish-email.sh: EOF: not found
ZED_SPARE_ON_IO_ERRORS is now a boolean - I/O errors is bad!
Events that can occur is defined in include/sys/fm/fs/zfs.h.
Include the class in the log message when invoking a script.