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
If email is configured, send a mail after replace is complete.
Take both success and failure of a replace into account when sending email.