나는 이메일을 보내기 위해 php의 mail() 함수를 사용하는 사이트에서 일하고 있습니다. 그러나 서버가 HTML 전자 메일을 보내는 데 문제가있어 이메일이 제대로 전달되지 않습니다. 제발 도와주세요 ... 코드는 다음과 같습니다 :은 html 형식의 메일을 보낼 수 없습니다.
<?php
$fromAddr = 'Frendzpark <[email protected]>'; // the address to show in From field.
$recipientAddr = '[email protected]';
$subjectStr = 'Demo:Account created successfully';
$mailBodyText = <<<HHHHHHHHHHHHHH
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Account created successfully</title>
</head>
<body>
<p>
<div style="color: #ff4e0a; height: 100px; font-weight: bold; font-size: 70px; font-family: 'Maiandra GD'; text-align: left; padding-left: 10px;">
Chatmasti</div><hr />
<div style="font-family: 'Trebuchet MS'; height: 160px; padding-left: 30px; font-size: 12px; border-left-width: thin; border-left-color: #ccccff; border-bottom-width: thin; border-bottom-color: #ccccff; border-right-width: thin; border-right-color: #ccccff;">
Thank you for signing up. Your account has been created successfully and your account
details are as follows:<br />
<br />
Username: <b>user</b><br />
Password: <b>pass</b><br />
<br />
You can start chatting after verifying your email address. To verify the email address
please click the link below:<br />
<a href="http://www.chatmasti.uk.tc/verify=3973hfuhfri23892">http://www.chatmasti.uk.tc/verify=3973hfuhfri23892</a><br />
Hope you enjoy this free service.<br />
<br />
Regards,<br />
Sanket Raut.<br />
Webmaster,<br />
Chatmasti</div>
</p>
</body>
</html>
HHHHHHHHHHHHHH;
$headers= <<<TTTTTTTTTTTT
From: $fromAddr
MIME-Version: 1.0
Content-Type: text/html;
TTTTTTTTTTTT;
$sent=mail($recipientAddr , $subjectStr , $mailBodyText, $headers);
if($sent)
print "Mail sent";
else
print "Error";
?>
어디서 정확하게 지정합니까? –
헤더 섹션에 있습니다. 이미 Content-type : text/html; 그래서 뒤에 charset = iso-8859-1을 넣으십시오. – Ray
@ 레이 : 정확히 어디에 지정해야합니까? –