Hi,
I'm trying to send emails via mail(), but the emails arrived to spam:
1.7 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
What do I need to do?
The code:
$namefile = $_POST['namefile'];
$sub = "./sub/".$namefile."s.html";
$gfh1 = fopen($sub, 'r');
$subject = fread($gfh1,filesize($sub));
fclose($gfh1);
$subject = "=?$charset?B?".base64_encode($subject1)."?=\n";
$filename = $_POST['filename'];
$getFile = "./emails/".$namefile.".html";
$gfh = fopen($getFile, 'r');
$contentofemail = fread($gfh,filesize($getFile));
fclose($gfh);
$message = '
<html>
<head>
<title></title>
</head>
<body>
'.$contentofemail.'
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=windows-1255' . "\r\n";
$headers .= 'From: '.$from.' <'.$email.'>' . "\r\n";
....
...
...
mail($to, $subject, $contentofemail, $headers);
I tried to remove this line:
$headers = 'MIME-Version: 1.0' . "\r\n";
But, I get:
0.9 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME
1.7 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
:queasy:
(windows-1255 is for Hebrew encoding, it's works)
Please help.
Thank you!