메일을 보내는 기능을 만들었지 만 html 코드를 해석합니다. 본문에 정확한 HTML 코드를 보내려면 어떻게해야합니까? 예를 들어 사용자는 <strong>text</strong>
을 받고 '굵게'는 굵게 표시되지 않아야합니다. html 코드로 phpmailer 이메일 보내기
function sendmail($dest,$subj ,$htmlmessage,$textmessage) {
$Mail = new PHPMailer(true);
try{
$Mail->IsSMTP(); // Use SMTP
$Mail->SMTPAuth = TRUE; // enable SMTP authentication
//$Mail->SMTPDebug = 2; // 2 to enable SMTP debug information
$Mail->Host = "smtp.gmail.com"; // Sets SMTP server
$Mail->Username = '[email protected]'; // SMTP account username
$Mail->Password = 'mypassword'; // SMTP account password
$Mail->SMTPSecure = "ssl"; //Secure conection
$Mail->Port = 465; // set the SMTP port
$Mail->SetFrom ('[email protected]', 'def');
$Mail->FromName = 'myname';
//$Mail->addReplyTo('[email protected]', 'Reply here');
$Mail->addAddress($dest, 'to'); // To:
$Mail->isHTML(false);
$Mail->Subject=$subj;
$Mail->Body=$htmlmessage;
$Mail->AltBody=$textmessage;
$Mail->Send();
}
catch (phpmailerException $e) {
file_put_contents('Mailerrors.txt', $e->errorMessage() , FILE_APPEND);
die("Problem with emailing.");
}
}
여기에 나는 단지 그들이 HTML 코드를 해석, 메일을 함수가 작업을 수행하고 나에게 이메일을 보내는
$dest='[email protected]';
$subj='hello';
$htmlmessage='this is the body<strong>asd</strong>';
$textmessage='this is the body';
sendmail($dest,$subj, $htmlmessage,$textmessage);
주를 보낼 수 있습니다.
'$ Mail-> isHTML (true); ' – turtle
여전히 코드를 HTML로 해석합니다. –
'$ htmlmessage = '
이 몸 ASD이다'하려고, 여전히 그것을 해석' – turtle