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' . "\r\n" .
'Content-type: text/html; charset=utf-8' . "\r\n" .
'From: xx@xx.com' . "\r\n" .
'Reply-To: xx@xx.com' . "\r\n" .
'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'];
由于它是单引号php认为它是字符串建议您将它放在双引号中
$message = "$_POST[dostawa]";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.