TAILIEUCHUNG - Phát triển web với PHP và MySQL - p 68

Building a Web-Based Email Service CHAPTER 27 645 The line $fullheaders = ($action==’show-headers’); could have been more verbosely—and perhaps more clearly—written as if($action==’show-headers’) $fullheaders = true; else $fullheaders = false; Next, we call the display_message() function. Most of this function outputs plain HTML, so we will not go through it here. It calls the retrieve_message() function to get the appropriate message from the mailbox: $message = retrieve_message($auth_user, $accountid, $messageid, $fullheaders); 27 BUILDING A WEB-BASED EMAIL SERVICE The retrieve_message() function is in the library. You can see the code for it in Listing . LISTING retrieve_message() Function from —This Function Retrieves One Specific Message from a Mailbox function retrieve_message($auth_user, $accountid, $messageid,. | Building a Web-Based Email Service 645 Chapter 27 The line fullheaders action show-headers could have been more verbosely and perhaps more clearly written as if action show-headers fullheaders true else fullheaders false Next we call the display_message function. Most of this function outputs plain HTML so we will not go through it here. It calls the retrieve_message function to get the appropriate message from the mailbox message retrieve_message auth_user accountid messageid fullheaders The retrieve_message function is in the library. You can see the code for it in Listing . Listing retrieve_message Function from This Function Retrieves One Specific Message from a Mailbox function retrieve_message auth_user accountid messageid fullheaders message array if auth_user messageid accountid return false imap open_mailbox auth_user accountid if imap return false header imap_header imap messageid if header return false message body imap_body imap messageid if message body message body This message has no body n n n n n n if fullheaders message fullheaders imap_fetchheader imap messageid else message fullheaders 27 Building a Web-Based Email Service Building Practical PHP and MySQL Projects 646 Part V Listing Continued message subject header- subject message fromaddress header- fromaddress message toaddress header- toaddress message ccaddress header- ccaddress message date header- date note we can get more detailed information by using from and to rather than fromaddress and toaddress but these are easier imap_close imap return message Again we have used open_mailbox to open the user s mailbox. This time however we are after a specific message. Using this function library we download the message headers and message body separately. The three IMAP functions we use here are imap_header imap_fetchheader and imap_body . Note that the two header functions are distinct from imap_headers the one we used previously. They are somewhat .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.