<?php
$username = "dummy";
$pgp="/usr/local/bin/gpg";
$from="Example.com website <website@example.com>";
$recp="Example orders <orders@example.com>";
$data="Text that will be encrypted";
$command = 'echo "'.$data.'" | '.$pgp.' -a --always-trust --batch "
$command.= '--no-secmem-warning -e -u "'.$from.'" -r "'.$recp.'"';
$oldhome = getEnv("HOME");
putenv("HOME=/home/$username");
$result = exec($command, $encrypted, $errorcode);
putenv("HOME=$oldhome");
$message = implode("\n", $encrypted);
// $message now contains the encrypted data.
$subject="New order from example.com website";
$header="From: {$from}";
mail($recp,$subject,$message,$header);
?>