Jump to content

Archived

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

dino_davi33

CC email form

Recommended Posts

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");

?>

Share this post


Link to post
Share on other sites

×

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.