2016-08-12 5 views
1

나는 inmotion 호스팅이있는 VPS를 가지고 있는데, 확인 이메일을 보내지 만 이메일을 보내려면 너무 많은 시간이 걸립니다. 메일을 보낼 때 html 코드를 구조화하는 가장 좋은 방법은 무엇입니까? 성능을 향상시킬 수 있습니까?PHP 메일이 매우 천천히 보내집니다.

이것은 내 코드입니다.

$subject = 'Mail activation'; 

$body = ' 
    <html> 
     <head> 
      <base target="_blank"> 
     </head> 
     <body> 
      <table style="max-width:800px; margin:0 auto; font-family: Arial, Helvetica, sans-serif;" cellspacing="0" cellpadding="10"> 
       <thead style="border-bottom:1px solid #DDD;"> 
        <tr> 
         <td align="center" style="border-bottom:1px solid #DDD;"> 
          <img src="http://p.unid.com/img/logoSASENegro.png" alt="" height="45" width="150"/> 
         </td> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
         <td> 
          Hi classmate 
         </td> 
        </tr> 
        <tr> 
         <td> 
          Press the following link. 
         </td> 
        </tr> 
        <tr> 
         <td> 
          www.google.com 
         </td> 
        </tr> 
        <tr> 
         <td> 
          You data: 
         </td> 
        </tr> 
        <tr> 
         <td> 
          ID - <b>'.$ids.'</b><br/> 
          Password - <b>'.$pass.'</b><br/> 
         </td> 
        </tr> 
        <tr> 
         <td> 
          Don't response this email. 
         </td> 
        </tr> 
       </tbody> 
      </table> 
     </body> 
    </html> 
'; 

$headers = "MIME-Version: 1.0\r\n"; 
$headers .="Content-type: text/html; charset=utf-8\r\n"; 
$headers .= "From: Contacto SASE <[email protected]>\r\n"; 

if(mail($emailC, $subject, $body, $headers)) 
+0

구문에 결함이 있습니다. '이 이메일에 응답하지 말 것'을보십시오. 문자열이 거기에서 끝납니다. – Joshua

+1

성능은 코드가 아니라 서버/MTA 설정과 관련이 있습니다. (주제 끄기). 그러나 메일 클래스와 적절한 SMTP 릴레이를 고려하십시오. – mario

답변

0

일부 서버에서는 mail()이 (가) 이메일을 매우 느리게 전송했습니다. 귀하의 문제는 메시지 내용과 관련이 없지만 귀하의 호스팅 제공 업체와 관련이 있습니다. 가능한 해결책으로 스크립트를 다른 SMTP 서버 (예 : gmail : Send email using the GMail SMTP server from a PHP page)를 통해 메일을 보내도록 전환 할 수 있습니다.