我想知道使用php的最简单的邮件代码
答案 0 :(得分:3)
您的问题不明确,但这是mail
函数最简单的用法:
// The message
$message = "Line 1\nLine 2\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
mail('caffeinated@example.com', 'My Subject', $message);
See the docs for more information
注意:强>
使用mail
功能存在问题:
SMTP
套接字更好的替代方案:
您可以使用PHPMailer
或者:
答案 1 :(得分:1)
mail('bill@gmail.com', 'subject', 'Whazup');
答案 2 :(得分:1)
<?php
mail('caffeinated@example.com', 'My Subject', $message);
?>
来自the php doc。