When using ssmtp for simple command line mailing:
$mail_to = "[email protected]";
$msg = "this would be an actual base64_encoded gzip msg";
$date = date(r);
$mail = "X-FROM: [email protected] \n";
$mail .= "X-TO: ".$mail_to. " \n";
$mail .= "To: ".$mail_to. " \n";
$mail .= "Date: $date \n";
$mail .= "From: [email protected] \n";
$mail .= "Subject: lifecheck \n";
$mail .= $msg." \n";
exec("echo '$mail' | /usr/sbin/ssmtp ".$mail_to);
be sure to invoke chunk_split() on your message body - ssmtp becomes unhappy with long lines and will subsequently trash your message.