<?php
$data = <<<EOD
Nighthawk,
Top secret, for your eyes only!
The enemy is closing in! Meet me at the cafe at 8.30am
to collect your forged passport!
HQ
EOD;
$key = file_get_contents("nighthawk.pem");
$fp = fopen("msg.txt", "w");
fwrite($fp, $data);
fclose($fp);
if (openssl_pkcs7_encrypt("msg.txt", "enc.txt", $key,
array("To" => "nighthawk@example.com", "From: HQ <hq@example.com>", "Subject" => "Eyes only"))) {
exec(ini_get("sendmail_path") . " < enc.txt");
}
?>