If you set the message as from
the sender's email, you are more likely to be trapped in spam filters (since the sender's server doesn't actually originate the message... yours does).
Rather, set a Reply-To:
header with the sender's email. Without seeing what you're doing in send_email()
function, it's hard to know how you'd implement that. With PHP's mail()
, it's easy.
<?php
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: sender@example2.com';
mail( 'recipient@example2.com', 'subject', 'message', $headers);
Just include the Reply-To:
header along with the "sender's" email address when you invoke send_email()
.