在下面的代码中,我使用以下行添加编码部分:
$mail->exec("set names utf8");
但是,电子邮件未正确发送。
我尝试了以下内容:
$to = $_POST['email'];
$subject = "Konfirmo regjistrimin ZEROPULSE Team";
$body = "<p>Përshendetje $emri, faleminderit per anetaresimin tuaj ne webfaqen <a href='http://www.flamurbeqiraj.com'>www.flamurbeqiraj.com</a>!</p>
<p>Per te aktivizuar llogarine tuaj, ju lutem <a href='".DIR."administrator/aktivizo.php?x=$id&y=$activasion'>klikoni ketu</a>.</p>
<p>T'gjitha te mirat, ZP Team.</p>";
$mail = new Mail();
$mail->setFrom(SITEEMAIL);
$mail->addAddress($to);
$mail->subject($subject);
$mail->exec("set names utf8");
$mail->body($body);
$mail->send();
如何更改编码UTF-8部分?
答案 0 :(得分:0)
实际上对于pdo,你必须在连接中使用utf-8字符集:
new PDO("mysql:host=$host;dbname=$db;charset=utf8")