我想用utf8编码发送这封电子邮件的信息。
我能为此做些什么?
include 'functions.php';
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$cap=strtoupper($_POST['cap']);
$error = '';
$mail = mail(WEBMASTER_EMAIL,$subject,$message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());我可以在utf8中发送什么?
发布于 2012-12-06 05:01:34
你可以使用php的utf8_encode函数。如下所示:
$message = utf8_encode(stripslashes($_POST['message']));这将存储在$message变量或任何其他变量中编码的字符串utf8。
编辑
如果您使用swiftmailer库,它将默认使用utf8编码。
https://stackoverflow.com/questions/13732253
复制相似问题