php - mail function return false when add html content type -


  function sendemail($to,$subject,$message,$headers=false){     $from = "app@boutiqueplatter.com";     $headers = "from: " . strip_tags($from ) . "\r\n";     $headers .= "mime-version: 1.0\r\n";     $headers .= "content-type: text/html; charset=iso-8859-1\r\n";      try     {         if(mail($to,$subject, $message, $headers))         {             $sentemail = true;         }         else         {             $sentemail = false;         }         var_dump($headers );     }     catch(exception $ex)     {         throw new exception($message, $code, $previous);         $sentemail = false;     }     return  $sentemail; } 

this function when remove header $headers .= "content-type: text/html; charset=iso-8859-1\r\n"; email send properly, when add line mail function return false. in local machine working fine

please help. thank you.

i got solution, add 'from' in end of header working.

function sendemail($to,$subject,$message,$headers=false){     $from = "app@boutiqueplatter.com";      $headers = "mime-version: 1.0\r\n";     $headers .= "content-type: text/html; charset=iso-8859-1\r\n";     $headers .= "from: " . strip_tags($from ) . "\r\n";     try     {         if(mail($to,$subject, $message, $headers))         {             $sentemail = true;         }         else         {             $sentemail = false;         }         var_dump($headers );     }     catch(exception $ex)     {         throw new exception($message, $code, $previous);         $sentemail = false;     }     return  $sentemail; } 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -