S.ber
S.ber

Reputation: 1

specials characters when sending mail via Php

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= "[email protected]";
$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

Upvotes: 0

Views: 50

Answers (1)

Kumar
Kumar

Reputation: 39

Change your charset:

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

Upvotes: 1

Related Questions