2010-04-22 4 views
2

나는 PHP에 익숙하지 않다. 사용자 업로드에 대한 확인을 보내려고합니다. 나는 이것을 위해 PHP 메일러를 사용하려고 노력하고있다. 그리고 다음 코드를 가지고 있지만 작동하지 않습니다. 어떤 도움을 주시면 감사하겠습니다. 당신이 PHP를 처음으로PHPMailer 문제

<?php 

if (!empty($_FILES)) { 
    $tempFile = $_FILES['Filedata']['tmp_name']; 
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; 
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; 

// $fileTypes = str_replace('*.','',$_REQUEST['fileext']); 
// $fileTypes = str_replace(';','|',$fileTypes); 
// $typesArray = split('\|',$fileTypes); 
// $fileParts = pathinfo($_FILES['Filedata']['name']); 

// if (in_array($fileParts['extension'],$typesArray)) { 
    // Uncomment the following line if you want to make the directory if it doesn't exist 
    // mkdir(str_replace('//','/',$targetPath), 0755, true); 

    move_uploaded_file($tempFile,$targetFile); 
    echo "1"; 



//Send confirmation email 

require_once('_mailClasses/class.phpmailer.php'); 
include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded 

$mail    = new PHPMailer(); 

$body    = 'There is a new online order. Please check your order folder.'; 
//$body    = eregi_replace("[\]",'',$body); 

$mail->IsSMTP(); // telling the class to use SMTP 
$mail->Host  = "mail.splashoflondon.com";  // SMTP server 
$mail->SMTPDebug = 2;        // enables SMTP debug information (for testing) 
// 1 = errors and messages 
// 2 = messages only 
$mail->SMTPAuth = true;       // enable SMTP authentication 
$mail->Host  = "mail.splashoflondon.com";  // sets the SMTP server 
$mail->Port  = 26;       // set the SMTP port for the GMAIL server 
$mail->Username = "[email protected]"; // SMTP account username 
$mail->Password = "correctpassword";      // SMTP account password 

$mail->SetFrom('[email protected]', 'Splash of London'); 

$mail->AddReplyTo("[email protected]","First Last"); 

$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; 

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test 

$mail->MsgHTML($body); 

$address = "[email protected]"; 
$mail->AddAddress($address, "John Doe"); 
$mail->Send(); 
} 

?> 
+1

"작동하지 않음"이란 무엇을 의미합니까? 그것은 작동하지 않는 것은 무엇입니까? 오류 메시지가 나타 납니까? –

+0

아약스 요청을하면 파일을 원하는 위치로 업로드하지만 확인 이메일을 보내지 않습니다. 정말 좋은 디버깅 도구를 가지고 vsphp를 사용하고 있습니다. 그냥 비주얼 스튜디오에서 PHP 프로젝트를 실행합니다 – XGreen

+2

오류 로그에 오류 메시지가 표시됩니까? 당신은 또한'$ mail-> send()'의 리턴 값을 검사하지 않을 것이다. phpmailers 웹 사이트의 예제에서 오류 메시지 http://phpmailer.worxware.com/index.php?pg=examplebmail –

답변

관련 문제