nashyboy Posted February 21, 2007 Share Posted February 21, 2007 Guys this is probably very straight forward however, i can't quite work it out. Please see the below code.... <?php $to = 'nashy@email.co.uk, '; $subject = 'test'; $message = "Blah Blah\n\n Name: " . $name . "\n Username: " . $username . "\n Site: " . $site . " \n Role: " . $role . " \n\n Regards\n Selection Services"; $headers .= "CC: ghgfd@alh.co.uk\r\n"; $headers .= "From: Can@alh.co.uk\r\n"; mail($to, $subject, $message, $headers); ?> All works except the cc field. I receive the email stating it has been cc'd to ghgfd@alh.co.uk however its doesnt actually go to them..... If someone could help it would be appreciated. Thanks, Paul Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 21, 2007 Share Posted February 21, 2007 Perhaps it is case-sensitive, the manual says "Cc" not "CC" Quote Link to comment Share on other sites More sharing options...
PureEvil Posted February 21, 2007 Share Posted February 21, 2007 Could it be getting filtered on their end possibly? I'd try another email address in place of theirs for testing. See if it reaches that address. Quote Link to comment Share on other sites More sharing options...
mbtaylor Posted February 21, 2007 Share Posted February 21, 2007 I recommend PHPMailer - http://phpmailer.sourceforge.net/ Its easy to use and powerful in features Quote Link to comment Share on other sites More sharing options...
nashyboy Posted February 22, 2007 Author Share Posted February 22, 2007 Have tried the various things above but no joy and dont particlatly want to use a mailer would rather have my own code work. i can get away without using the cc if i can send to 2 addresses. however the below doesnt work still.... <?php $to = 'nashy@email.co.uk, ghgfd@alh.co.uk'; $subject = 'test'; $message = "Blah Blah\n\n Name: " . $name . "\n Username: " . $username . "\n Site: " . $site . " \n Role: " . $role . " \n\n Regards\n Selection Services"; $headers .= "From: Can@alh.co.uk\r\n"; mail($to, $subject, $message, $headers); ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 22, 2007 Share Posted February 22, 2007 fully tested working ok. <?php $to = 'admin@me.com'; $subject = 'test!'; $message = "Blah Blah\n\n Name: " . $name . "\n Username: " . $username . "\n Site: " . $site . " \n Role: " . $role . " \n\n Regards\n Selection Services"; $headers = "From: Can@alh.co.uk\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; if(mail($to, $subject, $message, $headers)){ echo"Mail was sent to: $to"; }else{ echo"Sorry the email $to was bad "; } ?> Quote Link to comment Share on other sites More sharing options...
nashyboy Posted February 22, 2007 Author Share Posted February 22, 2007 Thats works great however, it doesnt give the line breaks anymore? Also how can i parse the "$name" (from the form) into the subject? Is just displaying as Blah Blah $name Quote Link to comment Share on other sites More sharing options...
nashyboy Posted February 22, 2007 Author Share Posted February 22, 2007 Dont worry sorted - Thanks! Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 22, 2007 Share Posted February 22, 2007 works perfect ok. <?php $name='redarrow'; $username="redarrow"; $site="www.redarrow.com"; $role="admin"; $to = 'admin@admin.com'; $subject = 'test!'; $message = "Blah Blah <br> Name: " . $name . "\n Username: " . $username . "<br> Site: " . $site . " <br> Role: " . $role . " <br> Regards\n Selection Services"; $headers = "From: Can@alh.co.uk\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; if(mail($to, $subject, $message, $headers)){ echo"mail was sent to: $to and $headers"; }else{ echo"soory the email was bad "; } ?> 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.