2017-01-17 3 views
0

PHPmailer를 사용하여 GoDaddy가 호스팅하는 웹에서 500 명의 내부 서버 오류가 계속 발생합니다. StackOverflow에서 내 도전 과제와 관련된 몇 가지 솔루션을 시도했지만 그 중 아무 것도 성공하지 못했습니다. 내 개인 정보에 대한 [email protected] :PHPmailer - 500 내부 서버 오류

require 'phpmailer/PHPMailerAutoload.php'; 
$feedback=''; 
$flag = array(); 
if(isset($_POST["submitlogin"]) and $_SERVER['REQUEST_METHOD'] == "POST"){ 

    $name = seo_friendly_url($_POST['name']); 
    $email = seo_friendly_url($_POST['email']); 
    $subject = seo_friendly_url($_POST['subject']); 
    $message = seo_friendly_url($_POST['message']); 

    //Email 

    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) { 
     $feedback="Invalid email format"; 
     array_push($flag,"false"); 
    }else { 
     array_push($flag,"true"); 
    } 
    //Email 

    //Name 
    if (preg_match('/^[-a-zA-Z0-9._]+$/', $name)){ 
     array_push($flag,"true"); 
    }else { 
     $feedback="Invalid name format"; 
     array_push($flag,"false"); 
    } 
    //Name 


    if (!in_array("false", $flag)) { 

     //SMTP needs accurate times, and the PHP time zone MUST be set 
     //This should be done in your php.ini, but this is how to do it if you don't have access to that 
     date_default_timezone_set('Etc/UTC'); 

     //Create a new PHPMailer instance 
     $mail = new PHPMailer; 
     //Tell PHPMailer to use SMTP 
     $mail->isSMTP(); 
     //Enable SMTP debugging 
     // 0 = off (for production use) 
     // 1 = client messages 
     // 2 = client and server messages 
     $mail->SMTPDebug = 2; 
     //Ask for HTML-friendly debug output 
     $mail->Debugoutput = 'html'; 
     //Set the hostname of the mail server 
     $mail->Host = "smtpout.asia.secureserver.net"; 
     //Set the SMTP port number - likely to be 25, 465 or 587 
     $mail->Port = 25; 
     //Whether to use SMTP authentication 
     //$mail->Username = '[email protected]'; 
     //$mail->Password = 'password'; 
     $mail->SMTPAuth = false; 
     //Set who the message is to be sent from 
     $mail->setFrom('[email protected]'); 
     //Set an alternative reply-to address 
     $mail->addReplyTo($email); 
     //Set who the message is to be sent to 
     $mail->addAddress('[email protected]');  // Add a recipient 
     $mail->addAddress('[email protected]'); 
     $mail->addAddress('[email protected]); 
     //Set the subject line 
     $mail->Subject = 'HLS Inquiry'; 
     //Read an HTML message body from an external file, convert referenced images to embedded, 
     //convert HTML into a basic plain-text alternative body 
     $mail->msgHTML($message); 







     $email_ar = $email; 
     $subject_ar = $name.", Thank you for your Inquiry"; 
     $acknowledgement_receipt = ' 
      <div style="padding:10px 20px;font-size:16px;"> 

       <p>Dear '.$name.',</p> 

       <p>We&#39;ve received your message and would like to thank you for contacting us. We will reply by email shortly.</p> 

       <p>Talk to you soon,</p> 

       <p> 
        <div>Customer Service</div> 

       </p> 

      </div> 
     '; 



     if ($mail->send()) { 
      $feedback = "<span style='color:green;'>Thank you for your inquiry. We will respond to you within 24 hours.</span>"; 
     } 

} 

내가 같은 이메일 값의 일부를 대체 있습니다 :

여기 내 코드입니다.

JustHost에서 호스팅 한 친구 웹 사이트의 설정을 이미 사용했기 때문에 이메일 설정이 정확하다고 생각했습니다.

+0

큰 따옴표로 addAddress ('[email protected] ')를 교체하려고 -> addAddress는 ("[email protected]") 나는 아직도 누락 된 작은 따옴표를 넣어했지만, –

답변

0

이 줄은 작은 따옴표가 없습니다 : 당신이 볼 수 있기 때문에

$mail->addAddress('[email protected]); 

이 SO에서 매우 분명 얼마나 그 시점에서 휴식을 강조 구문.

오류 500이 표시되고 아무 것도 표시되지 않으면 웹 서버의 오류 로그에서 확인해야한다는 표시입니다.

+0

작동하지 않았다 :( 어디 서버 로그를 볼 수 있습니까? – ASCII

+0

일반적으로'/ var/log/apache2/error.log' 또는 이와 유사합니다. – Synchro