2012-12-17 3 views
0
내가 Gmail에서 보낸 디렉토리에 유지하지 이메일

PHPMailer 클래스와의 Gmail : 보낸 된 이메일은 Gmail을

http://code.google.com/a/apache-extras.org/p/phpmailer/

보낸 된 이메일을 보내 PHPMailer 클래스를 사용

에서 보낸 디렉토리에 유지하지.

내가 틀렸어?

try { 
    $mail = new PHPMailer(true); //New instance, with exceptions enabled 

    $body    = file_get_contents('ct.html'); 
    $body    = preg_replace('/\\\\/','', $body); //Strip backslashes 

     $mail->IsSMTP(); // telling the class to use SMTP 
     $mail->Host  = "smtp.gmail.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->SMTPSecure = "ssl";     // sets the prefix to the servier 
     $mail->Host  = "smtp.gmail.com";  // sets GMAIL as the SMTP server 
     $mail->Port  = 465;     // set the SMTP port for the GMAIL server 
     $mail->Username = "*******@gmail.com"; // GMAIL username 
     $mail->Password = "*******";   // GMAIL password 

     if($mail->SmtpConnect()){ 
      echo "SmtpConnect"; 
     }else{ 
      echo "ERROR"; 
     } 

     $mail->IsSendmail(); // tell the class to use Sendmail 

     $mail->AddReplyTo("*******@gmail.com", "*****"); 

     $mail->From = "*******@gmail.com"; 
     $mail->FromName = "*******"; 

     $to = "[email protected]*******.***"; 

    $mail->AddAddress($to); 

    $mail->Subject = "First PHPMailer Message " . rand(); 

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

    $mail->MsgHTML($body); 

    $mail->IsHTML(true); // send as HTML 

    $mail->Send(); 
    echo 'Message has been sent.'; 
} catch (phpmailerException $e) { 
    echo $e->errorMessage(); 
} 

이메일을 보낸 편지함에 어떻게 저장할 수 있습니까?

감사합니다.

+0

다음은이 질문과 중복되는 내용입니다. [phpmailer로 보낸 메일은 보낸 메일 폴더로 이동하지 않습니다.] (http://stackoverflow.com/questions/8561495/sent-mails-with-phpmailer-dont-go-go- to-sent-imap-folder), 솔루션에 대해서는 잘 모르겠다. – Zeeshan

답변

1

This 귀하의 문제와 관련이있는 것으로 보이며 smtp를 사용할 때 저장되지 않는 것으로 보입니다. 그러나 발신 계정을 숨은 참조로 보내고 해당 메일을 별도의 폴더에 걸러 낼 수 있습니다.

관련 문제