2013-03-05 1 views
2

php mail() 함수를 사용하여 보낸 전자 메일 메시지에 어떻게 주제별 휴식 (< hr>)을 출력 할 수 있습니까? 전자 메일에서는 주제별 휴식 시간 대신 < hr> 자체가 나타납니다.출력 <hr> (전자 메일 메시지) PHP

+0

ru 가로줄 ' – PSR

+3

헤더를 설정해야 해당 html 이메일을 말하고 적절한 HTML을 포함해야합니다. 예 4는 [manual] (http://php.net/manual /en/function.mail.php) –

+0

은 이메일을 일반 텍스트가 아닌 HTML로 보냈습니다. –

답변

1

체크 아웃 예 4 :

http://php.net/manual/en/function.mail.php

<?php 
// multiple recipients 
$to = '[email protected]' . ', '; // note the comma 
$to .= '[email protected]'; 

// subject 
$subject = 'Birthday Reminders for August'; 

// message 
$message = ' 
<html> 
<head> 
    <title>Birthday Reminders for August</title> 
</head> 
<body> 
    <p>Here are the birthdays upcoming in August!</p> 
    <table> 
    <tr> 
     <th>Person</th><th>Day</th><th>Month</th><th>Year</th> 
    </tr> 
    <tr> 
     <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> 
    </tr> 
    <tr> 
     <td>Sally</td><td>17th</td><td>August</td><td>1973</td> 
    </tr> 
    </table> 
</body> 
</html> 
'; 

// To send HTML mail, the Content-type header must be set 
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

// Additional headers 
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n"; 
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; 
$headers .= 'Cc: [email protected]' . "\r\n"; 
$headers .= 'Bcc: [email protected]' . "\r\n"; 

// Mail it 
mail($to, $subject, $message, $headers); 
?> 
+1

나는 매뉴얼에서 가난한 대답만을 인용하는 것을 고려한다. –

+0

공정한 비판 -하지만 나는 가능한 한 완전한 답을 제공하고 사람들이 단지 답을 찾고 있다면 여러 페이지로 이동하지 않도록합니다. 그리고이 경우, 예제는 정확히 필요한 것입니다. – Sol

+0

잘 링크가있는 코멘트는 내가 '대답'전에했던 것처럼 충분합니다 .-) –

0

당신이, 당신은 이메일한다는 것은 콘텐츠 형식 헤더를 추가해야합니다) (메일로 보내 이메일에서 HTML을 사용하려면 HTML로 파싱되어야합니다. 예 4를 참조하십시오 http://php.net/manual/en/function.mail.php