Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP mail()问题,如果它包含URL_Php_Php Ini - Fatal编程技术网

PHP mail()问题,如果它包含URL

PHP mail()问题,如果它包含URL,php,php-ini,Php,Php Ini,我正在尝试使用PHP mail()发送简单的html电子邮件 以下代码工作正常 $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; If(mail('xyz@gmail.com', 'test mail', 'test<hr>this is a test mail', $headers)){ Echo 'OK'; }

我正在尝试使用PHP mail()发送简单的html电子邮件

以下代码工作正常

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
If(mail('xyz@gmail.com', 'test mail', 'test<hr>this is a test mail', $headers)){
  Echo 'OK';
} else{
  Echo 'Not ok';
}
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/html;字符集=iso-8859-1'。“\r\n”;
如果(邮寄)xyz@gmail.com“,”测试邮件“,”测试
这是一封测试邮件“,$headers)){ 回声‘OK’; }否则{ 回声“不正常”; }
问题:只要我在正文中添加了一些特定的url,代码仍然会说可以,但从未收到过电子邮件

If(mail('xyz@gmail.com', 'test mail', 'test<hr>this is a test mail from www.xyz.com', $headers)){
  Echo 'OK';
} else{
  Echo 'Not ok';
}
If(邮件)xyz@gmail.com“,”测试邮件“,”测试
这是来自www.xyz.com的测试邮件“,$headers)){ 回声‘OK’; }否则{ 回声“不正常”; }
有人能告诉我问题是什么以及如何解决吗?

mail()
有第四个和第五个参数(可选)。第五个参数是应该作为选项直接传递给sendmail的内容。使用以下命令:

$body = 'test<hr>this is a test mail from'.htmlentities('www.xyz.com');

if(mail('xyz@gmail.com','test mail', $body,$headers,'-f from@xyz.com'))
{
....
}
$body='test
这是一封来自.htmlentities('www.xyz.com')的测试邮件; 如果(邮寄)xyz@gmail.com“,”测试邮件“,$body,$headers,”-ffrom@xyz.com')) { .... }
希望它现在起作用:)


在搜索邮件时,请检查您的垃圾邮件文件夹。

将您的邮件发送到此站点,以查看服务器是否首先将您的所有
'
更改为正常
'
,这将单独产生不希望的结果,
解析错误:…
解析错误:语法错误,意外的“@”
您是否正确设置了邮件配置?@Shah“以下代码工作正常”,它会向您抛出一个分析错误。我测试了你上面的代码,这就是我的结果。请参阅下面我的答案,经过充分测试。笔记也在里面。不要使用不规则的撇号,也就是你们现在使用的“反撇号”。对不起,我在word中键入了几行。我更新了代码。代码在godaddy遇到问题的地方都能正常工作。在过去三天里,我一直在寻求他们的支持,但都没有成功。所以我在这里结束,也许有人会指导我。谢谢它的工作,但我想问题是,它阻止包含特定域的电子邮件。你知道原因是什么以及如何解决吗?