Jump to content

[SOLVED] mail function sending email to both sender and recipient


scott_m

Recommended Posts

This mail function is being used for a send to friend page.

 

When I call the function, instead of just sending to the recipient, it also sends the same email to the sender. Any ideas why this would happen?

 

function SendMail( $theFrom="", $theTo="", $theSubject="", $theMessage="") {


$headers = 'From: ' . $theFrom . ";\n";
$headers .= 'Content-type: ' . $theType . ";\n";
$headers .= "Reply-To: $theFrom\n";
$headers .= "X-Mailer: PHP/".phpversion();

mail($theTo, $theSubject, $theMessage, $headers, "-f$theFrom");
}

SendMail("My Name <[email protected]>", "[email protected]", "test subject", "test message", "text/html");

 

The email is being sent "on behalf of" the domain on the server. Could that be the reason? Is there something I can put in the headers? something that needs to get changed in server settings?

 

Any ideas?

 

Thanks,

Scott

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.