Reputation: 275
Any idea why the [Enter email] field on this form will only reach [email protected] if the email entered matches [email protected]?
If I put in any other email address than the one listed in $to=, the email doesn't send.
$fieldname = 'images';
if ($_POST){
// we'll begin by assigning the To address and message subject
$to="[email protected]";
$subject="Registration";
$from = "<".stripslashes($_POST['email']).">";
// generate a random string to be used as the boundary marker
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
// now we'll build the message headers
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"\n";
Here's a Pastebin.
Upvotes: 0
Views: 43
Reputation: 150138
You are setting the from header to be the address posted in the form, and the to header to be your email address. Should be reversed if you are trying to send an email to them.
$to="[email protected]";
$subject="Registration";
$from = "<".stripslashes($_POST['email']).">";
If indeed you want the email to appear to come from the address listed in the form, you can't in general do that. You can't send email on behalf of another use (your SMTP server is likely to reject it these days). This is to prevent pfishing attacks (FROM: [email protected], SUBJECT: What is that password again?).
Send it from an email address that you control. Include the email address from the form as part of the body of the email.
Upvotes: 1