Using the PHP mail() command, you can set the envelope from address using the -f command, and you can include the from address in the message headers as well, like so:
$to = "to@to.com";
$from = "from@from.com";
$subject = "subject";
$message = "this is the message body";
$headers = "From: $from";
$ok = @mail($to, $subject, $message, $headers, "-f " . $from);