0

I've got this php code that send an email with some texts and special characters :

// send email
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$mail_user= "myMail@gmail.com";
$subject = "Message d'alerte" ;

$message = utf8_encode("Une personne est en danger !\r\n \r\n <br> Nom :$nom  <br> Prénom : $prenom <br>   Numéro de téléphone : $phone\r\n   <br> Type de bateau : $boat\r\n Téléphone du proche : $phoneFriend <br> ");

mail($mail_user, $subject, $message, $headers);

Problem

The user receive this email :

Une personne est en danger ! 
Nom :amir 
Prénom : Khalida 
Numéro de téléphone : 95626    
Coordonnées :
Téléphone du proche 

As you can see, every character with accents are not supported.. How can I do to change "é" by "é" when sending the email ?

Thx

shubham715
  • 3,324
  • 1
  • 17
  • 27
S.ber
  • 1
  • 1
  • 3
    Possible duplicate of [php mail special characters utf8](http://stackoverflow.com/questions/19708097/php-mail-special-characters-utf8) – Nikhil Vaghela Nov 08 '16 at 04:25
  • `utf8_encode - Encodes an ISO-8859-1 string to UTF-8` you aren't sending `iso-8859-1` – chris85 Nov 08 '16 at 05:41

1 Answers1

1

Change your charset:

$headers .= "From: $from \r\n";
$headers .= 'Content-Type: text/html; charset=UTF-8\r\n';
Kumar
  • 39
  • 9