I am using PHPMailer to send emails for password recovery, welcome ... etc. The fact is that the body of the message is correctly coded by applying $mail->CharSet = 'UTF-8';
but the subject of the message does not recognize the accents, so they come to me without subject.
Here I paste the code:
require("../phpmail/class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Mailer="smtp";
$mail->SMTPAuth = true;
$mail->Host = "XXXXX";
$FromServ = "XXXXX";
$mail->Username = "XXXXX";
$mail->Password = "XXXXX";
$mail->Port = 587;
$mail->From = "XXXXX";;
$mail->Timeout=60;
$mail->Sender = "XXXXX";;
$mail->FromName = "XXXXX";
$mail->AddAddress($email);
$mail->IsHTML(true);
$subject = "Recuperar contraseña"; // << No reconoce la Ñ
$mail->Subject = $subject;
$body= ' AQUÍ EL MENSAJE';
'
If anyone knows how I can do to correctly code the matter, I would do myself a great favor. I have already applied rules like utf8_decode ()
and all it does is change the Ñ to a question mark (Recover password).
Thank you all in advance.