2017-09-29 7 views
0

분명히 완료된 codeigniter가있는 응용 프로그램을 작성하고 있지만 그 안에 1 개의 플러그인이 더 필요합니다. 내 Outlook 계정에서 내 codeigniter 애플 리케이션에 대한 모든 이메일을 잡아 싶습니다.귀하의 codeigniter 응용 프로그램에 이메일을 추적하는 방법

내 코드 개발자 앱에서 메시지를 보내고받을 수 있다면 정말 좋을 것입니다.

내 두 번째 질문은 내 codeigniter 응용 프로그램의 일정을 Outlook의 일정에 어떻게 적용시킬 수 있습니까?

답변

2

이메일 수신 (IMAP)에 대한 몇 가지 프로토콜에나가는 (SMTP) 또는 그래서 당신은 당신의 메일을 읽고 메일을 보낼 전망에서 이러한 설정을 구성해야합니다 등

POP3와 같은 유사한 작동합니다. 마찬가지로 PHP로 메일을 읽고 php를 사용하여 메일을 보낼 수 있습니다.

전자 메일 보내기 :

당신은 나가는 잘 작동 코어 이메일 라이브러리를 CodeIgniter를 사용할 수 있습니다. sending emails codeigniter

읽기 우편물 :

이 스크립트는 전망에 제공하는 구성을 제공하여 메일을 읽을 수 있습니다.

<?php 
class Email_reader { 

    // imap server connection 
    public $conn; 
    // inbox storage and inbox message count 
    private $inbox; 
    private $msg_cnt; 

    // email login credentials 
    private $server = 'YOUR_MAIL_SERVER'; 
    private $user = '[email protected]'; 
    private $pass = 'yourpassword'; 
    private $port = 143; // change according to server settings 

    // connect to the server and get the inbox emails 
    function __construct() { 
     $this->connect(); 
     $this->inbox(); 
    } 

    // close the server connection 
    function close() { 
     $this->inbox = array(); 
     $this->msg_cnt = 0; 
     imap_close($this->conn); 
    } 
    // open the server connection 
    // the imap_open function parameters will need to be changed for the particular server 
    // these are laid out to connect to a Dreamhost IMAP server 
    function connect() { 
     $this->conn = imap_open('{'.$this->server.'/notls}', $this->user, $this->pass); 
    } 

    // move the message to a new folder 
    function move($msg_index, $folder='INBOX.Processed') { 
     // move on server 
     imap_mail_move($this->conn, $msg_index, $folder); 
     imap_expunge($this->conn); 
     // re-read the inbox 
     $this->inbox(); 
    } 
    // get a specific message (1 = first email, 2 = second email, etc.) 
    function get($msg_index=NULL) { 
     if (count($this->inbox) <= 0) { 
      return array(); 
     } 
     elseif (! is_null($msg_index) && isset($this->inbox[$msg_index])) 
     { 
      return $this->inbox[$msg_index]; 
     } 
     return $this->inbox[0]; 
    } 

    // read the inbox 
    function inbox() { 
     $this->msg_cnt = imap_num_msg($this->conn); 
     $in = array(); 
     for($i = 1; $i <= $this->msg_cnt; $i++) { 
      $in[] = array(
       'index'  => $i, 
       'header' => imap_headerinfo($this->conn, $i), 
       'body'  => imap_body($this->conn, $i), 
       'structure' => imap_fetchstructure($this->conn, $i) 
      ); 
     } 
     $this->inbox = $in; 
    } 
} 
?> 

메일을 읽는 기본 스크립트로, 요구 사항에 따라 향상시킬 수 있습니다.