php提交表单到邮箱代码怎么写?高手指教!

2025-04-19 12:05:22
推荐回答(2个)
回答1:

php有mail函数。
$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);

回答2:

发送邮件的代码比较麻烦 去下载个类吧 phpmailer挺好用的 配置也简单 网上有相关教程