1

Something wrong with my codes?

<?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';
}

?>

some of my send email program is working this piece of codes is not I dont why I already configure the php.ini and send_mail.ini.

T_T
  • 13
  • 1
  • 5

1 Answers1

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';
}
?>
Manish Jesani
  • 1,339
  • 5
  • 20
  • 36
  • Windows has very poor flexibility with the mailing system which is what you are facing right now! Try testing you code with Linux machines. I checked your code and it is fine, Upload it to a online hosting and test it, it shall work fine. – radiopassive Sep 23 '14 at 05:47
  • Thank you I already found the answer my header contain too many characters – T_T Sep 23 '14 at 07:29