我在网站上使用PHP,并且想添加电子邮件功能。
我已经安装了WAMPSERVER。
如何使用PHP发送电子邮件?
使用PHP的mail()功能是可能的。请记住,邮件功能在本地服务器上不起作用。
mail()
<?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?>