Jump to content

Recommended Posts

Hi everyone. I have gone over and over this and cannot see the fault.

The script emails the BCC perfectly, however it is not sending it to the "to" and "CC" recipients. The emails are not going to junk/spam folders and on the BCC, the to and CC addresses are appearing correctly on Outlook/Thunderbird.

 

Any ideas will be greatly appreciated. The script mails from two separate forms, and sends/prints a designated reply dependant on which form has been submitted, a call back form and general mail form.

 

---

 

if(isset($_GET["fs"]) && $_GET["fs"] == "cb"){

if(isset($_POST["sub"]) && isset($_GET["cb"])){

$emto = "enquiries@****.co.uk";

$headers = "From: callback-request@****.co.uk\r\n";

$headers .= "CC:****@****.co.uk\r\n";

$headers .= "BCC:****@****.com\r\n";

$headers .= "X-Mailer: PHP/".phpversion();

$subj = "Callback Requested - ****.co.uk";

$mesg = "Hi.\r\nA callback request has been submitted at ****.co.uk\r\n";

$mesg .= "Name: ".$_POST["name"]."\r\n";

$mesg .= "Telephone: ".$_POST["tel"]."\r\n";

$mesg .= "Company: ".$_POST["comp"]."\r\n";

$mesg .= "Time: ".$_POST["time"]."\r\n";

mail($emto,$subj,$mesg,$headers);

$return = "<div class=\"blk1\">

<h1 id=\"title\">Request Call Back</h1>

Thank you. We shall contact you between ".$_POST["time"].".

</div>";

}

else{

$return = "<div class=\"blk1\">

<h1 id=\"title\">Request Call Back</h1>

<a href=\"?fs=em\"><small>Click to send a message</small></a>

<form action=\"?fs=cb&cb\" method=\"post\">

<label for=\"name\">Your Name</label><br />

<input name=\"name\" class=\"inp-t\" /><br /><br />

<label for=\"comp\">Company</label><br />

<input name=\"comp\" class=\"inp-t\" /><br /><br />

<label for=\"tel\">Telephone Number</label><br />

<input name=\"tel\" class=\"inp-t\" /><br /><br />

<label for=\"time\">What is the best time for you? <small><em>Mon-Fri</em></small></label><br />

<select name=\"time\">

<option value=\"9.00-10.00\">9:00 - 10:00</option>

<option value=\"10.00-11.00\">10:00 - 11:00</option>

<option value=\"11.00-12.00\">11:00 - 12:00</option>

<option value=\"12.00-13.00\">12:00 - 13:00</option>

<option value=\"13.00-14.00\">13:00 - 14:00</option>

<option value=\"14.00-15.00\">14:00 - 15:00</option>

<option value=\"15.00-16.00\">15:00 - 16:00</option>

<option value=\"16.00-17.00\">16:00 - 17:00</option>

</select><br /><br />

<input type=\"submit\" class=\"subm\" value=\"Send Request\" name=\"sub\" />

</form>

</div>";

}

}

elseif(isset($_GET["em"]) && $_GET["fs"] == "em"){

if(isset($_POST["sub"])&& isset($_GET["em"])){

$emto = "enquiries@****.co.uk";

$headers = "From: contact-request@****.co.uk\r\n";

$headers .= "CC:****@****.co.uk\r\n";

$headers .= "BCC:****@****.com\r\n";

$headers .= "X-Mailer: PHP/".phpversion();

$subj = "Web Contact Form - ****.co.uk";

$mesg = "Hi.\r\nThe contact form has been submitted at ****.co.uk\r\n";

$mesg .= "Name: ".$_POST["name"]."\r\n";

$mesg .= "Telephone: ".$_POST["tel"]."\r\n";

$mesg .= "Company: ".$_POST["comp"]."\r\n";

$mesg .= "Message: ".$_POST["msg"]."\r\n";

mail($emto,$subj,$mesg,$headers);

$return = "<div class=\"blk1\">

<h1 id=\"title\">Email Us</h1>

Thank you. We shall respond as soon as we can.

</div>";

}

else{

$return = "<div class=\"blk1\">

<h1 id=\"title\">Email Us</h1>

<a href=\"?fs=cb\"><small>Click to request call back</small></a>

<form action=\"?fs=em&em\" method=\"post\">

<label for=\"name\">Your Name</label><br />

<input name=\"name\" class=\"inp-t\" /><br /><br />

<label for=\"comp\">Company</label><br />

<input name=\"comp\" class=\"inp-t\" /><br /><br />

<label for=\"tel\">Telephone Number</label><br />

<input name=\"tel\" class=\"inp-t\" /><br /><br />

<label for=\"ema\">Email Address</label><br />

<input name=\"ema\" class=\"inp-t\" /><br /><br />

<label for=\"msg\">Message</label><br />

<textarea name=\"msg\" id=\"inp-textarea\"></textarea>

<br /><br />

<input type=\"submit\" class=\"subm\" value=\"Send Message\" name=\"sub\" />

</form>

</div>";

}

}

else{};

 

-------

Dan White

Link to comment
https://forums.phpfreaks.com/topic/267746-php-mail-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.