개발! 딱 깔끔하고 센스있게!

이메일 읽는 PHP 라이브러리 본문

개발 스크랩 메모/PHP

이메일 읽는 PHP 라이브러리

렉사이 2020. 12. 21. 02:39

나는 지금 신첩메일 저장소에 이메일을 보내는데, 불행히도, 그것은 수신 대신 보내는 데 쓰이고 있다.

알고 싶습니다.

IMAP 를 통해 이메일 계정에 연결해 이메일을 읽을 수 있는 라이브가 있습니다.

여기 PHP IMAP 함수: http:us3.PHP.net/manual/en/book.IMAP.PHP

그러나 내 문제는 누군가가 모든 이메일의 대체 libarary 또는 IMAP 포장 종류를 알아볼 수 있다는 것을 알고 있다.

정말 아무것도 찾지 못했습니다.

미리 감사합니다.

대답

다음을 만나다

http:ww.php.net/mailparse

http://garrettstjohn.com/entry/reading-emails-with-php/

해보다

PHP 로 이메일 읽기

[email protected]'; private $pass = 'yourpassword'; private $port = 143; // adjust 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; } } ?> 
Comments