2014-04-25 5 views
-1

등록하려는 사용자에게 확인 메일을 보내고 싶습니다. Iam은 PHP 메일러를 사용하여 메일을 전송합니다. 내가 파일을 실행하면PHP 메일러 - 이메일 발신

require_once("PHPMailer/class.phpmailer.php"); 

     $mail = new PHPMailer(); 
     $mail->IsSMTP(); 
     $mail->Host = "localhost"; 
     $mail->SMTPAuth = true;// turn on SMTP authentication 
     $mail->Username = "root";// SMTP username 
     $mail->Password = "";// SMTP password 
     $mail->SetLanguage("en","PHPMailer/language"); 

     //compose mail 
     $mail->From = "[email protected]"; 
     $mail->FromName = "Cinema Admin"; 
     $mail->AddAddress($_POST['email']); 
     $mail->AddReplyTo("[email protected]", "Cinema Admin"); 
     $mail->Subject = 'Your confirmation link here'; 
     $mail->Body = "Your confirmation link\r\n"; 
     $mail->Body .= "Click on this link to activate your sccount\r\n"; 
     $mail->Body .= "http://localhost/user.login_plugin/confirm.php?passkey=$confirm_code"; 

     //send mail 
     if (!$mail->Send()) 
     { 
      echo "Message was not sent <p>"; 
      echo "Mailer Error: " . $mail->ErrorInfo; 
      exit; 
     } 

     echo "Message has been sent"; 

, 그것은

Message was not sent 

Mailer Error: SMTP connect() failed. 

사람이 등록 된 사용자의 EMAILID에 로컬 호스트에서 메일을 보내는 저를 제안 할 수 말한다 : 여기 내 코드입니다. 스택 오버플로에서 "이메일 끝"과 관련된 제목이 거의 없지만 모든 게시물에서 해결책을 찾지 못했습니다.

미리 감사드립니다.

+0

이라고 할 수하는 SMTP 인증, 스피 윈도우 7 –

+0

를 사용하지 않는 다른 사용자의 SMTP 인증을 확인하거나 당신이이 있나요 메일 서버가 로컬로 설정 되었습니까? – user2686207

+0

사용하여 확인 어떻게 말해 줄 수 SMTP –

답변

0

smtp 부분을 삭제 해 주실 수 있습니까? 귀하의 의견으로는 메일 서버 설정이 없습니다.

$mail = new PHPMailer(); 

    $mail->SetLanguage("en","PHPMailer/language"); // remove smtp things 
당신은 Gmail을 사용 설정 SMTP하려는 경우 예를 들어, SMTP를 사용하여 메일을 보내려면 SMTP 세부 사항을 필요로한다
+0

나는 당신의 제안에 따라 모든 smtp 일을 제거했고, 이제 나는 그것을 실행할 때 : Mailer Error : 메일 기능을 인스턴스화 할 수 없었다. – user2686207

0

,

$mail->IsSMTP(); // telling the class to use SMTP 
    $mail->SMTPAuth = true;   // enable SMTP authentication 
    $mail->SMTPSecure = "tls";  // sets the prefix to the servier 
    $mail->Host  = "smtp.gmail.com";  // sets GMAIL as the SMTP server 
    $mail->Port  = 587;     // set the SMTP port for the GMAIL server 
    $mail->Username = "[email protected]"; // GMAIL username 
    $mail->Password = "yourpassword";   // GMAIL password 

당신은 SMTP를 사용을하지 않으려면 기본 메일 기능

$mail->IsMail(); //Sets Mailer to send message using PHP mail() function. 
+0

Gmail뿐 아니라 Gmail이나 야후 또는 핫메일 등과 같은 메일 일 수 있습니다. 내 로컬 호스트의 사용자 등록 이메일로 이메일을 보내야합니다. – user2686207