Book Image

Programming with CodeIgniter MVC

Book Image

Programming with CodeIgniter MVC

Overview of this book

The CodeIgniter Model-View-Controller framework provides genius simplicity, flexibility, and efficient resource usage, boosting performance and reusability. "Programming with CodeIgniter MVC" reviews the unique features of CodeIgniter using simple, easy-to-follow, and practical examples. Programming with CodeIgniter MVC provides a simple step-by-step guide to efficiently utilizingthe CodeIgniter MVC framework for developing web applications. This book is packed with engaging examples to understand the usage of controllers, libraries, and (Codeigniter) CI Models. This book commences with a quick discussion of the CodeIgniter Integration with  external plugins such as Flickr API, Google Maps and more will be reviewed with clear usage examples. It will then cover CI naming convention rules, mandatory and optional configurations, and usage within a CI project. It will also cover user defined configurations. By the end of this book, you will not only understand user-defined libraries in a CI framework, but also their services, role, usage, and scope with the help of an example-based approach. The book also covers helpers, models, and views, as well as their usage. Using this book, youwill soonbe able to develop feature-rich web applications using the CodeIgniter MVC framework. "Programming with CodeIgniter MVC" is a one-stop solution to developing solutions with CodeIgniter MVC.
Table of Contents (15 chapters)
Programming with CodeIgniter MVC
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Appendix
Index

Example 2 – sending e-mails with attachments


In this example, we will see how the controller can load a mail service library and use it to send mail attachments.

The CI mail library is not an auto-loaded library, and hence, will be loaded by the controller we are building for sending e-mail.

The CI mail library makes it easy to send subject messages of non-English languages supporting UTF-8 both for the subject and the mail body. Adding attachments to an e-mail becomes a piece of cake using the CI mail library. We only need to have the files on a known directory path in our server and refer to them to attach them to the mail.

We can attach one or more files to create the mail body. HTML/TEXT is defined via a simple configuration setting to the CI mail library.

This example will be constructed from the mail controller only; you may add a rendered view later on to add to the example report on the mailing list, sending a report of a list of e-mail destinations instead of just one or two destinations...