dino_davi33 Posted July 13, 2006 Share Posted July 13, 2006 I am setting up an email form where I am trying to setup the CC. The good news is that it works! The bad news is when i recieve the email it says it was sent from the sysadmin@mail.myurl.com when it should have the email address of the person filling out the form as the sender. here is what I have... your help is greatly appreciated! <?php // some local variables $from_name = $name; $name = $name; $address1 = $address1; $address2 = $address2; $city = $city; $state = $state; $zip = $zip; $phone = $phone; $email = $email; $comments = $comments; $appointment = $appointment; $radiobutton = $radiobutton; $hear_about_us = $hear_about_us; $from_email = "$from_email"; $to_name = "Coordinator"; $to_email = "email1@company.com"; $cc_email = "email2@company.com"; $from_certification = $certification; $contact_preference = $contactPreference; $find_site = $siteReference; $new_url = $surl; $response = "Dear $from_name \n"; $response .= "\n"; $response .= "A representative will contact you soon to answer any questions you may have. Thank you for your interest. \n"; $response .= " \n"; $response .= "company name\n"; $subject = "Request"; $emessage = "$Emessage"; // headers need to be in the correct order... $headers = "From: $from_email \n"; $headers = "CC: $cc_email \n";#CC: field added here $headers .= "Reply-To: <$from_email>\n"; $headers .= "MIME-Version: 1.0\n"; the following must be one line (post width too small) $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $headers .= "Content-Transfer-Encoding: quoted-printable\n"; $headers .= "X-Sender: $from_name<$from_email>\n"; $headers .= "X-Mailer: PHP4\n"; //mailer $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal $headers .= "Return-Path: <$from_email>\n"; //plaintext section begins $message .= "Name: $name \n"; $message .= "Address: $address1 \n"; $message .= "Address: $address2 \n"; $message .= "City: $city \n"; $message .= "State: $state \n"; $message .= "Zip: $zip \n"; $message .= "Phone Number: $phone \n"; $message .= "email: $email \n"; $message .= "Comments/Questions: $comments \n"; $message .= "Best time to contact: $appointment \n"; $message .= "Contact Via: $radiobutton \n"; $message .= "How we heard about you: $hear_about_us \n"; $message .= "\n"; // send the message mail("$to_name<$to_email>", $subject, $message, $headers); $from_name = $name; $message = $response; $send_email = $from_email; $send_name = $from_name; $from_email = $to_email; $from_name = $to_name; $headers = "From: $from_email \n"; $headers .= "Reply-To: <$from_email>\n"; $headers .= "MIME-Version: 1.0\n"; // the following must be one line (post width too small) $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $headers .= "Content-Transfer-Encoding: quoted-printable\n"; $headers .= "X-Sender: $from_name<$from_email>\n"; $headers .= "X-Mailer: PHP4\n"; //mailer $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal $headers .= "Return-Path: <$from_email>\n"; mail("$send_name<$send_email>", $subject, $message, $headers); header ("Location: thanks.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/14477-cc-email-form/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.