[英]Not able to send mail via LOCAL xampp server
PHP CODE BELOW: Already done configuration in php.ini & sendmail.ini PHP 代码如下:已在 php.ini 和 sendmail.ini 中完成配置
<?php
$to_email = "receipient@gmail.com";
$subject = "Simple Email Test via PHP";
$body = "Hi,nn This is test email send by PHP Script";
$headers = "From: sender\'s email";
if (mail($to_email, $subject, $body, $headers)) {
echo "Email successfully sent to $to_email...";
} else {
echo "Email sending failed...";
}
Getting the following error:得到以下错误:
To insert a PHP variable in a string you have to use curly brackets.要在字符串中插入 PHP 变量,您必须使用大括号。
Like this:像这样:
<?php
$to_email = "receipient@gmail.com";
$subject = "Simple Email Test via PHP";
$body = "Hi,nn This is test email send by PHP Script";
$headers = "From: sender's email";
if (mail($to_email, $subject, $body, $headers)) {
echo "Email successfully sent to {$to_email}..."; // <-- here the brackets
} else {
echo "Email sending failed...";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.