PHP 메일() 함수를 통해 HTML 콘텐츠를 보내려고합니다. 내 코드가 무엇이 잘못되었는지 알지 못합니다. 나는 많은 시간을 보냈고, 시간을 보냈다. 그러나 아무것도 효과가 없었습니다. 누구든지 제 코드에 어떤 문제가 있는지 말해 줄 수 있습니까? PHP 메일() 함수가 HTML을 보내지 않습니다.
<?php
$to = "[email protected]";
$today = date("Y/m/d");
$today = $today." 00:00";
$count_cash_inc = mysql_query("SELECT sum(income) as inc, sum(expense) as exp FROM journal_entry WHERE `date` >= '$today'");
$inc = mysql_fetch_array($count_cash_inc);
$income_c = $inc['inc'];
$epense_c = $inc['exp'];
$counter_cash = $income_c - $epense_c;
$subject = "Daily Report From Sri Sankalpa";
$headers = "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "CC: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$message = '<center><h1>Sri Sankalpa Daily Journal Report</h1>';
$message .= '<br><table><tr><td>Date</td><td>Total Income</td><td>Total Expense</td><td>Balance</td></tr>';
$message .= '<tr><td>'.date("d-m-Y").'</td><td>'.$income_c.'</td><td>'.$epense_c.'</td><td>'.$counter_cash.'</td></tr></table><br>';
$message .= '<p>To Know More... Please Click <strong><a target="_blank" href="http://srisankalpa.com/demo/journal_entry.php">HERE</a></strong></p></center>';
mail($to, $subject, $message, $headers);
?>
난 \ R \ R \ n 변화하는 캐릭터 = UTF-8 캐릭터 세트는 ISO-8859-1 = 제거 시도. 그러나 아무것도 작동하지 않습니다. 도움을 청했습니다. 아래 라인이없는 일반 텍스트로 메일을 완벽하게 보내십시오.
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
간단한 'mail()'보다 고급이며 쉽게 오류를 추적 할 수있는 [PHPmailer] (http://phpmailer.worxware.com/)를 사용하십시오. –
메일이 전송되었지만 Gmail에서 스팸을 제거했습니다 (스팸). 이를 막기 위해 phpmailer를 사용하십시오 –
이 헤더를 추가하십시오'$ headers. = 'Content-type : text/html; charset = iso-8859-1 '. "\ r \ n"; "및 –