我无法用某些语言发送电子邮件。我尝试用UTF-8添加content-type。Asi尝试对$body = utf8_encode($_POST['sendmessage'];
进行编码,但仍然不起作用。
当我尝试发送
Meu nome é Rick
电子邮件正在发送为
Meu nome é Rick
我的代码是
$from = "xxxxx <xxxxxxxxxx@gmail.com>";
$to = $_POST['sendname']."<".$_POST['sendemail'].">";
$subject = $_POST['sendsubject'];
$body = $_POST['sendmessage'];
$host = "pro.turbo-smtp.com";
$username = "xxxxxxxxxx";
$password = "xxxxxxxxxx";
$headers = array ('Content-Type' => 'text/html; charset=UTF-8',
'From' => $from,
'To' => $to,
'Date' => date("r"),
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => 587,
'auth' => true,
'username' => $username,
'password' => $password));
$crlf = "\r\n";
$mime = new Mail_mime($crlf);
$mime->setHTMLBody($body);
$bodyx = $mime->get();
$headers = $mime->headers($headers);
$mail = $smtp->send($to, $headers, $bodyx);
任何帮助都很感激。:)
1条答案
按热度按时间6yt4nkrj1#
在你的标题中有一个小错误
应该是
以分号
;
作为分隔符。另外,请尝试使用经过测试的软件包(如PHPMailer)来发送邮件。他们会照顾到你所面临的问题等细微差别。