Jump to content

COde for a Cc


RON_ron

Recommended Posts

I'm not receiving $ft as a Cc. Why is that??

 

$to = "$email";

$headers = "From:" .$tf."\r\n";

$headers .= "Cc: $tf\r\n";

$subject = "SUBJECT";

$message = "bla bla bla...";

$message = "Name: " . $thename;

 

$sentOk = mail("$tf, $email",$subject,$message,$headers);

echo "sentOk=" . $sentOk;

Link to comment
Share on other sites

I think the problem might be here:

 

 

$headers .= "Cc: $tf\r\n";

 

Assuming your email address has the '@' which is a reserved character in PHP, it's possibly being interpreted by PHP.

 

Maybe this will fix it:

 

$headers .= 'Cc: ' . $tf . "\r\n";

 

Notice where I used single quotes vs. double quotes -- it's very important to the end result.

 

 

 

 

 

 

 

Link to comment
Share on other sites

:( still it's the same. I think the problem is in here.

 

$to = "$email";

$headers = "From:" .$tf."\r\n";

$headers .= 'Cc: ' . $tf . "\r\n";

$subject = "SUBJECT";

$message = "bla bla bla..."; 

$message = "Name: " . $thename; 

 

$sentOk = mail("$tf, $email",$subject,$message,$headers);

echo "sentOk=" . $sentOk;

Link to comment
Share on other sites

Yeah, I didn't even look carefully at that, but that's not how you pass parameters.  should be:

 

 

$sentOk = mail($to, $subject, $message, $headers);

 

 

In the future, more information is better.  I assumed that your emails were actually going out, since you stated that the problem was in the Cc: when in fact the entire email was not being sent.

 

 

 

 

Link to comment
Share on other sites

Have you put in some debug code that echos or print_r's your variables prior to the call to mail()?  Are these what you expect them to be?  What are the values of $to, $subject, $message, $headers?

 

Let's see the current version of the code you have as well.

Link to comment
Share on other sites

The full server side script

 

<?PHP

//my original mail$to = "mymail@mail.com";

 

$subject = "$thecompany request";

$headers = "From:" .$email."\r\n";

$message = "Name: " . $thename;

$message .= "\nCompany or Club Name: " . $thecompany;

$message .= "\nAddress: " . $theaddress;

$message .= "\nRequired Date: " . $thedate;

$message .= "\nPhone: " . $phone;

$message .= "\nEmail: " . $email;

 

$sentOk = mail("$to",$subject,$message,$headers);

echo "sentOk=" . $sentOk;

 

//delaer and clients duplicate emails

$to = "$email";

 

$subject = "Thank you...";

$headers = "From:" .$tf."\r\n";

$headers .= 'Cc: ' . $tf . "\r\n";

$message = "thank you....";

$message = "Name: " . $thename;

$message .= "\n\nCompany or Club Name: " . $thecompany;

$message .= "\n\nAddress: " . $theaddress;

$message .= "\n\nRequired Date: " . $thedate;

 

$sentOk = mail($to, $subject, $message, $headers);

echo "sentOk=" . $sentOk;

 

?>

 

My requirement is

ORIGINAL mail - only to me (no one will see it).

Duplicate mails - to the dealer & client with less info and different message + heading.

Link to comment
Share on other sites

Ok, so let's try and clean this up, and then I'll ask questions:

//my original mail
$to = 'mymail@mail.com';

$subject = "$thecompany request";
$headers = 'From:' . $email . "\r\n";
$message = "Name: " . $thename;   
$message .= "\nCompany or Club Name: " . $thecompany;
$message .= "\nAddress: " . $theaddress;
$message .= "\nRequired Date: " . $thedate;
$message .= "\nPhone: " . $phone;
$message .= "\nEmail: " . $email;

$sentOk = mail($to, $subject, $message, $headers);
echo "sentOk= $sentOk";

//delaer and clients duplicate emails
$to = $email;

$subject = "Thank you...";
$headers = 'From:' .$tf . "\r\n";
$headers .= 'Cc: ' . $tf . "\r\n";
$message = "thank you....";   
$message = "Name: " . $thename;   
$message .= "\n\nCompany or Club Name: " . $thecompany;
$message .= "\n\nAddress: " . $theaddress;
$message .= "\n\nRequired Date: " . $thedate;

$sentOk = mail($to, $subject, $message, $headers);
echo "sentOk= $sentOk";
?>

 

So, now the question -- is this the *entire* script?  Where are the values of the variables coming from -- I don't see you getting them from a $_POST or $_GET.  Is this because you're using register_globals?

 

At any rate, I don't see where the value of $tf is set.  If it has no value, obviously things won't work.  This is why I suggessted for debugging you echo out the values for example:

 

echo '$to-> ' . $to . '
';
echo '$subject-> ' . $subject . '
';
echo '$message-> ' . $message . '
';
echo '$headers-> ' . $headers . '
';

$sentOk = mail($to, $subject, $message, $headers);
echo "sentOk= $sentOk";

Link to comment
Share on other sites

Are you using the cleaned up version I provided, that removed some of the stuff that wasn't required? 

 

You also never provided info about the operating system and MTA you are using. 

 

Does email #1 get sent?

 

Does email #2 get sent, and if so what are the email headers.

 

This is all important diagnostic info, that only takes a minute to determine.

Link to comment
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.