I have trouble with sending emails on my website.
Here is a code:
$to = 'xx@xx.com' . ', ';
$to .= 'yy@xx.com';
$subject = 'Potwierdzenie zakupu.';
$message = '$_POST[dostawa]';
$headers =
'MIME-Version: 1.0' . "
" .
'Content-type: text/html; charset=utf-8' . "
" .
'From: xx@xx.com' . "
" .
'Reply-To: xx@xx.com' . "
" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
When I put text in my message it's sending text but if I put some variables it's sending $_POST[dostawa]
I can print this variables before and after this code with echo.
Change from
$message = '$_POST[dostawa]';
into
$message = $_POST['dostawa'];
Since it is in single quote php consider it as string Recommend you to please put it into double quote
$message = "$_POST[dostawa]";