[thelist] php mail cc

Matt Warden mwarden at gmail.com
Fri Feb 23 10:06:10 CST 2007


On 2/23/07, Joel D Canfield <joel at streamliine.com> wrote:
> any tips on why this doesn't actually send the CC?
>
> <?php
> if(isset($_POST['submit'])) {
>         $to = "joel at streamliine.com";
>         $subject = "Website contact";
>         $name_field = $_POST['RealName'];
>         $email_field = $_POST['Email'];
>         $telephone_field = $_POST['Telephone'];
>         $othercomments_field = $_POST['OCQ'];
>         $headers = "From: realaddress at realsite.com";
>         $headers .= "Cc: spinhead at gmail.com";
>         $headers .= "Reply-To: realaddress at realsite.com";
>         $body = "From:\n    $name_field\n\nEmail:\n
> $email_field\n\nPhone:\n    $telephone_field\n\nOther Comments or
> Questions:\n    $othercomments_field\n";
>         mail($to, $subject, $body, $headers);
> }
> ?>

Do an echo $headers and all will become clear.

See also the additional_headers section of:
http://us2.php.net/manual/en/function.mail.php

Specifically:
"Multiple extra headers should be separated with a CRLF (\r\n)."

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list