2012-05-03 2 views
0

기본 이메일을 보내는 코드가 있습니다. 하지만 SMTP를 들어, 내가이 완벽하지 못했습니다 :smtp를 통해 cakephp를 사용하여 이메일 보내기

 function send(){ 

      $this->Email->smtpOptions = array(
       'port'=>'465', 
       'timeout'=>'30', 
       'host' => 'ssl://smtp.gmail.com', 
       'username'=>'[email protected]', 
       'password'=>'mypassword', 
      ); 

     $this->Email->delivery='smtp'; 

      $this->Email->send = 'debug'; 

      $this->Email->to = '[email protected]'; 
     $this->Email->subject = 'hurrah'; 
//  $this->Email->replyTo = '[email protected]'; 
     $this->Email->from = 'Charmaine Khay Sorila<[email protected]>'; 
     //$this->Email->send('Here is the body of the email Chams Email Test'); 
     //Set the body of the mail as we send it. 
     //Note: the text can be an array, each element will appear as a 
     //seperate line in the message body. 

     if ($this->Email->send()) { 
      $this->Session->setFlash('Simple email sent'); 
     } else { 
      $this->Session->setFlash('Simple email not sent'); 
      $this->set('smtp_errors', $this->Email->smtpError); 
     } 
     } 

    } 

내가가되고, $ this-> email-> 전달 = 'SMTP'없이이 작업을 얻었다 ;,하지만 난 그 라인을 추가 할 때, 어떤 이메일이 모두 전송 될 수 없다 당신이 실제로 이메일을 보내 대신 기능을 테스트 할 싶지 않은 경우 :(

+0

디버그 옵션을 사용하는지, 그것을 제거하려고 – yossi

+0

똑같은 것 yossi.. 실제로 실제로 일어나는 일은 몇 초 동안 페이지가로드되어 이메일을 보내지 않는 것입니다 ... : – Charmie

+0

첫 번째 : 당신이 얻는 오류 (s?)는 무엇입니까? – yossi

답변

0

, 당신은 다음과 같은 배달 옵션을 사용할 수 있습니다

Copy to Clipboard 
$this->Email->delivery = 'debug'; 
+0

. 나는 그것을 작동시키지 만 그 일은 .. 실제로 메일을 배달하는 데 사용되는 smtp인지를 확인하여 의도적으로 비밀번호를 잘못 입력했으나 여전히 이메일을 보냈습니다 ...>. < – Charmie

관련 문제