tailieunhanh - PHP and MySQL Web Development - P130

PHP and MySQL Web Development - P130: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Sending Mail 617 Figure Using mail forwarding we can report the spammer. Listing send_message Function from This Function Sends the Message That the User Has Typed In function send_message to cc subject message send one email via PHP global HTTP_SESSION_VARS if db_connect return false query select address from users where username . HTTP_SESSION_VARS auth_user . result mysql_query query if result return false else if mysql_num_rows result 0 return false 618 Chapter 27 Building a Web-Based Email Service Listing Continued else other From .mysql_result result 0 address . r nCc cc if mail to subject message other return true else return false As you can see this function uses mail to send the email. First however it loads the user s email address out of the database to use in the From field of the email. Replying to or Forwarding Mail The Reply Reply All and Forward functions all send mail in the same way that New Message does. The difference in how they work is that they fill in parts of the new message form before showing it to the user. Look back at Figure message we are forwarding has been indented with the symbol and the Subject line prefaced with To. Similarly the Reply and Reply All options will fill in the recipients subject line and indented message. The code to do this is activated in the body section of as follows case reply-all set cc as old cc line if imap imap open_mailbox HTTP_SESSION_VARS auth_user HTTP_SESSION_VARS selected_account if imap header imap_header imap messageid if header- reply_toaddress to header- reply_toaddress else to header- fromaddress cc header- ccaddress subject Re . header- subject body add_quoting stripslashes imap_body imap messageid imap_close imap Sending Mail 619 display_new_message_form HTTP_SESSION_VARS auth_user to cc subject body break case reply set to address as reply-to or from of the current message if imap imap open_mailbox HTTP_SESSION_VARS auth_user HTTP_SESSION_VARS

TỪ KHÓA LIÊN QUAN