mail.sh: apply more recent updates from contrib/hooks/post-receive-email
Since mail.sh moved into Girocco, it stopped automatically picking up
the contrib/hooks/post-receive-email updates.
Apply the ones that are most applicable and do not conflict with any
of the Girocco-specific changes. These are:
* Add mime headers and make sure the body is UTF-8
* Use plumbing commands instead of porcelain to decrease fragility
* Add Auto-Submitted header (RFC3834) to help quell vacation auto responders
* Match up $LOGBEGIN..$LOGEND pairs correctly
* Fix some spelling errors and comments
* Update the logic that avoids sending empty emails
* In stdin mode allow subsequent emails to be sent even if earlier ones fail
There should be no change in content of the sent emails (other than making
sure they're now encoded in UTF-8).