我创建了一个从命令行运行的PHP脚本,并使用mail函数发送消息。
$email_from = "support@wideservices.gr";
$email_subject = "my subject";
$email_to = "spyros@wideservices.gr";
$message="message in greek";
$headers = "From: ".$email_from;
mail($email_to,$email_subject,$message,$headers);
拉丁字母的邮件还可以,但是希腊语我得到的东西是这样的:
我试图使用:
$character_set = "utf-8";
但是没有成功,它不是一个网页,所以我不能尝试meta。
答案 0 :(得分:1)
我将回答我自己的问题,它使用此代码和希腊显示正确的邮件。
$email_from = "support@wideservices.gr";
$email_subject = "my subject";
$email_to = "spyros@wideservices.gr";
$message="message in greek";
$headers="MIME-Version: 1.0"."\n";
$headers.="Content-type: text/plain; charset=UTF-8"."\n";
$headers.="From: ".$email_from;
mail($email_to, '=?UTF-8?B?'.base64_encode($email_subject).'?=', $message, $headers, '-fnoreply@domain.com');