我的代码出了什么问题?
<?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。
答案 0 :(得分:0)
<?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';
}
?>