susanloek
susanloek

Reputation: 411

PHP Mail with CC

I like to send a contact-form with a php cc-field.

My current code does not work:

$email_headers = "From: $vorname <$email>";
$email_headers .= "Cc: <$email>";

Upvotes: 0

Views: 97

Answers (2)

Tristup
Tristup

Reputation: 3663

Use the following code :

$email_headers= 'From: Birthday Reminder <$email>' . "\r\n";
$email_headers .= 'Cc: $email' . "\r\n";

Hope this will work for you. You can check more from here too :http://php.net/manual/en/function.mail.php

Upvotes: 1

vard
vard

Reputation: 4136

You need to separate your headers lines with a carriage return \r\n:

$email_headers = "From: $vorname <$email>" . "\r\n";
$email_headers .= "Cc: <$email>";

According the PHP mail documentation:

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

Upvotes: 4

Related Questions