如何使用PHP发送电子邮件?

如何使用PHP发送电子邮件?,php,email,Php,Email,可能的重复项: mail() 此函数的返回值为bool。您应该使用它来确定邮件是否成功发送 您可能希望签出双引号字符串和heredoc字符串: $name = 'Benedict'; $greeting = 'Hello ' . $name . '\n Would you like a cup of tea?'; $greeting = "Hello $name \n Would you like a cup of tea?"; $greeting = <<<GREE

可能的重复项:


mail()

此函数的返回值为
bool
。您应该使用它来确定邮件是否成功发送

您可能希望签出双引号字符串和heredoc字符串:

$name = 'Benedict';

$greeting = 'Hello ' . $name . '\n Would you like a cup of tea?';
$greeting = "Hello $name \n Would you like a cup of tea?";
$greeting = <<<GREETING
Hello $name
Would you like a cup of tea?
GREETING;
$name='Benedict';
$greeting='Hello'$名字。”\你想喝杯茶吗;
$greeting=“Hello$name\n要喝杯茶吗?”;

$greeting=您是否有机会重新格式化代码另外,它应该做什么?@06mickey-在您可能检查$email_地址是否有效之前,了解您多次遇到的问题会很有帮助,否则您将容易受到电子邮件标题注入的攻击
$name = 'Benedict';

$greeting = 'Hello ' . $name . '\n Would you like a cup of tea?';
$greeting = "Hello $name \n Would you like a cup of tea?";
$greeting = <<<GREETING
Hello $name
Would you like a cup of tea?
GREETING;