Make sSMTP Non-Blocking for PHP

If you're trying to send e-mail from PHP (in Drupal or not) using sSMTP you'll find any page sending an e-mail out stalling for several seconds while sSMTP logs in and sends the e-mail out. It's a serious performance hit and can make using your website rather annoying. If you're not concerned about the return code from the sSMTP call you can easily launch sSMTP in the background and it let your page continue to go about its business with something like:

#!/bin/sh
script -q -c "/usr/sbin/ssmtp $*" /dev/null

Put this script somewhere early in your path ahead of the real ssmtp command or point your PHP directly at your script and things will be much snappier.