Create a ZED init script
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
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.
Create a script that mails admin (if ZFS_EMAIL is set) if a vdev fails probe.
Note that ZED_SPARE_ON_IO_ERRORS needs to be a very low number
because ZFS will kick a drive very quickly if it detects I/O errors.
Script to notify admin(s) that a vdev have been removed.
Events that can occur is defined in include/sys/fm/fs/zfs.h.