I have upgrade my server php version to 5.4.30
When I use mail() with this version it send mails to other mail id like my company's webmail but when i use Gmail/yahoo Email it fails to send Email and gives 500 Internal Server Error
Code :
<?php
$arr = array('myemail@company.com','myemail@gmail.com');
foreach($arr AS $key => $value)
{
$to = $value;
$subject = "Test Mail";
$message = "<p>TEST</p>";
$from = "senderemail@gmail.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: <".$from.">" ;
mail($to, $subject, $message, $headers);
// It send mail to myemail@company.com this id
// but for gmail id it shows error
}
?>
我从服务器端更改了一些设置。.i将我的站点ip添加到连接器的服务器设置中,它再次像魅力一样工作并保存了我的头发。
<?php
ob_start();
$arr = array('myemail@company.com','myemail@gmail.com');
foreach($arr AS $key => $value)
{
$to = $value;
$subject = "Test Mail";
$message = "<p>TEST</p>";
$from = "senderemail@gmail.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: <".$from.">" ;
mail($to, $subject, $message, $headers);
ob_flush();
}
ob_end_flush();
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.