[PHP Warning: mail(): “ sendmail_from” not set in php.ini or custom “From:” header missing

后端 未结 4 1309
挽巷
挽巷 2020-11-30 09:22

I am trying to use PHP\'s mail() function to send a test mail.

$to = \"****@gourab.me\";
$sub = \"Php Mail\";
$msg = \"Test Message From PHP\";

mail($to, $s         


        
4条回答
  •  鱼传尺愫
    2020-11-30 09:56

    It seems your From header is not correctly formatted. Try this instead:

    $headers =  'MIME-Version: 1.0' . "\r\n"; 
    $headers .= 'From: Your name ' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    
    mail($to, $subject, $body, $headers);
    

提交回复
热议问题