Phpメーラーcronジョブのコードを書いています。電子メールは行き来していますが、なぜ私はHTML電子メールでコードを受信しています。HTMLテンプレートの代わりに。
また、適切な電子メールヘッダーを使用し、他のユーザーの電子メールアカウントでテストしました。HTMLしかし、電子メールでコードを印刷するのと同じ問題。
<html><body><h2>Hello</h2></body></html>テンプレートコードの代わりにメッセージでも使用します。<html><body><h2>Hello</h2></body></html>しかし、電子メール受信での同じ問題の印刷。
PHPコード
 //database connection
        require_once("include/config.inc.php");
        require_once("include/functions.inc.php");
        //init function 
        mailerCrone();
        //defined functions
        function mailerCrone() {
            $site_admin  = 'myemail@gmail.com';
            $headers = "MIME-Version: 1.0" . "\r\n";
            $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
            $headers = "From: " . $site_admin . "\r\n";
            $headers .= "Reply-To: ". $site_admin . "\r\n";
            $currentdate =  date('Y-m-d H:i:s');
            //get data to send mails 
            $getDataTomail = mysql_query("SELECT * FROM sendmails where status = 0 ORDER BY id ASC limit 0,10");
            while($resDataTomail = mysql_fetch_array($getDataTomail)) {
                $templateId = $resDataTomail['templ_id'];   
                $dataPreparedId = $resDataTomail['id'];     
                //get the template data
                $getTemplate = mysql_query("SELECT * FROM templates where id  = $templateId");
                $resTemplate = mysql_fetch_array($getTemplate);
                echo $msg = '<html><body>'.$resTemplate['templ_content'].'</body></html>';
                //mail($to, $subject, $message, $headers);
                $mailResponce = mail($resDataTomail['subs_email'], $resTemplate['templ_name'], $msg, $headers);
                if($mailResponce == '1') { 
                    //update status of selected data after send mail
                    $updateSendMailData = mysql_query("UPDATE sendmails SET status = '1' WHERE id = $dataPreparedId") or die(mysql_error());
                }
            }
        }