RON_ron Posted October 12, 2009 Share Posted October 12, 2009 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; Quote Link to comment Share on other sites More sharing options...
RON_ron Posted October 12, 2009 Author Share Posted October 12, 2009 someone please help... :-\ Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 12, 2009 Share Posted October 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
RON_ron Posted October 12, 2009 Author Share Posted October 12, 2009 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; Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 12, 2009 Share Posted October 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
RON_ron Posted October 12, 2009 Author Share Posted October 12, 2009 Not getting the $tf as yet!! Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 12, 2009 Share Posted October 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
RON_ron Posted October 12, 2009 Author Share Posted October 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 12, 2009 Share Posted October 12, 2009 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"; Quote Link to comment Share on other sites More sharing options...
RON_ron Posted October 12, 2009 Author Share Posted October 12, 2009 Yep this is the entire script. The values come from FLASH & an MySQL db. (Flash sends data using LoadVars) $tf variable is set with an email from the db. The script works fine except for the Cc matter. Quote Link to comment Share on other sites More sharing options...
RON_ron Posted October 13, 2009 Author Share Posted October 13, 2009 ANYONE WITH A PIECE OF ADVICE! Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 13, 2009 Share Posted October 13, 2009 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. Quote Link to comment 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.