Như đã đề cập trước đây, dòng đầu tiên của tập tin này sẽ được sử dụng như chủ đề e-mail. Điều này rất hữu ích, vì nó cho phép chúng tôi bao gồm logic mẫu trong chủ đề e-mail cũng như trong cơ thể. Chúng tôi sẽ bao gồm tên đầu tiên của người dùng trong đối tượng e-mail. | Simpo PDF Merge and Split Unregistered Version - http CHAPTER 4 USER REGISTRATION LOGIN AND LOGOUT 99 of DatabaseObject_User and the new initialization of the _newPassword property. This property must be public so the template can access its value. Listing 4-21. Creating a Pronounceable Password with Text_Password php class DatabaseObject_User extends Databaseobject . other code public _newPassword null . other code protected function preInsert this- _newPassword Text_Password create 8 this- password this- _newPassword return true . other code Finally we can create the template. As mentioned previously the first line of this file will be used as the e-mail subject. This is useful as it allows us to include template logic in the e-mail subject as well as in the body. We will include the user s first name in the e-mail subject. Listing 4-22 shows the contents of which is stored in . templates email. You may want to customize this template to suit your own requirements. Listing 4-22. The E-mail Template Used when New Users Register user- profile- first_name Thank You For Your Registration Dear user- profile- first_name Thank you for your registration. Your login details are as follows Login URL http phpweb20 account login Username user- username Password user- _newPassword Sincerely Web Site Administrator Simpo PDF Merge and Split Unregistered Version - http 100 CHAPTER 4 USER REGISTRATION LOGIN AND LOGOUT Figure 4-4 shows how the e-mail will look when received by the user. Hopefully the user s e-mail client will make the login URL clickable. You could choose to use an HTML e-mail instead but if the e-mail client can t automatically highlight links in a text e-mail it probably can t render HTML e-mails either. Figure 4-4. An example of the e-mail sent to a user when they register Implementing Account Login and Logout Now that users have a way of registering on the system .