如何使用 PHP 从网站发送电子邮件?
How to send an email from a website using PHP?
我开发了一个网站,想从该网站域发送邮件
我已经配置了邮件功能,然后它运行良好,但几个月后它在这里不起作用是我的代码
$email_from = 'xxx@domainname.lk';//<== update the email address
$email_subject = "New Visitor";
$email_body = "new visitor".
$to = 'qqq@gmail.com';//<== update the email address
$headers .= "From: $email_from \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: thank-you.html');
我认为 $email_body 变量的值应该以分号 (;) 结尾,并且 $headers 应该像下面这样写
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
我开发了一个网站,想从该网站域发送邮件 我已经配置了邮件功能,然后它运行良好,但几个月后它在这里不起作用是我的代码
$email_from = 'xxx@domainname.lk';//<== update the email address
$email_subject = "New Visitor";
$email_body = "new visitor".
$to = 'qqq@gmail.com';//<== update the email address
$headers .= "From: $email_from \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: thank-you.html');
我认为 $email_body 变量的值应该以分号 (;) 结尾,并且 $headers 应该像下面这样写
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();