PHP发送邮件功能在其他网页上不起作用

PHP发送邮件功能在其他网页上不起作用,php,email,localhost,sendmail,Php,Email,Localhost,Sendmail,我的密码有问题吗 <?php $rand_2 = "abcdefghijklmnopqeABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $rand_key = substr(str_shuffle($rand_2), 0, 30); $to = "meanlinsey@gmail.com"; $subject = "Account Validation"; $body = "Good Day! "."Mary Ann Linsey"."\n\n

我的密码有问题吗

<?php

 $rand_2 = "abcdefghijklmnopqeABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
 $rand_key = substr(str_shuffle($rand_2), 0, 30);


 $to = "meanlinsey@gmail.com";
 $subject = "Account Validation";
 $body = "Good Day! "."Mary Ann Linsey"."\n\n Copy this validation code below to 
 confirm your registration in Portal \n\n".$rand_key;
 $header = "From: Portal";



if(mail($to, $subject, $body, $header)){
    echo 'Message has been sent to: <strong>'.$to.'</strong>';
}else{
    echo 'something went wrong';
}

?>

我的一些发送电子邮件程序正在运行这段代码不是我不知道为什么我已经配置了php.ini和send_mail.ini


<?php

 $rand_2 = "abcdefghijklmnopqeABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
 $rand_key = substr(str_shuffle($rand_2), 0, 30);


 $to = "meanlinsey@gmail.com";
 $subject = "Account Validation";
 $body = "Good Day! "."Mary Ann Linsey"."\n\n Copy this validation code below to 
 confirm your registration in Portal \n\n".$randn_key;


 $headers ="Reply-To: \"".$name."\" <".$email_sender.">\r\n";
$headers .="MIME-Version: 1.0\r\n";
$headers .="From: \"".$name."\" <".$email_sender.">\r\n";
$headers .="Content-Type: text/html; charset=utf-8\r\n"; 



if(mail($to, $subject, $body, $headers)){
    echo 'Message has been sent to: <strong>'.$to.'</strong>';
}else{
    echo 'something went wrong';
}
?>

Windows的邮件系统灵活性很差,这正是您目前面临的问题!尝试用Linux机器测试您的代码。我检查了你的代码,它是好的,上传到一个在线托管和测试它,它将工作良好。谢谢你,我已经发现我的标题包含太多字符的答案