introduction.rst 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. Introduction
  2. ============
  3. Swift Mailer is a component-based library for sending e-mails from PHP
  4. applications.
  5. Organization of this Book
  6. -------------------------
  7. This book has been written so that those who need information quickly are able
  8. to find what they need, and those who wish to learn more advanced topics can
  9. read deeper into each chapter.
  10. The book begins with an overview of Swift Mailer, discussing what's included
  11. in the package and preparing you for the remainder of the book.
  12. It is possible to read this user guide just like any other book (from
  13. beginning to end). Each chapter begins with a discussion of the contents it
  14. contains, followed by a short code sample designed to give you a head start.
  15. As you get further into a chapter you will learn more about Swift Mailer's
  16. capabilities, but often you will be able to head directly to the topic you
  17. wish to learn about.
  18. Throughout this book you will be presented with code samples, which most
  19. people should find ample to implement Swift Mailer appropriately in their own
  20. projects. We will also use diagrams where appropriate, and where we believe
  21. readers may find it helpful we will discuss some related theory, including
  22. reference to certain documents you are able to find online.
  23. Code Samples
  24. ------------
  25. Code samples presented in this book will be displayed on a different colored
  26. background in a monospaced font. Samples are not to be taken as copy & paste
  27. code snippets.
  28. Code examples are used through the book to clarify what is written in text.
  29. They will sometimes be usable as-is, but they should always be taken as
  30. outline/pseudo code only.
  31. A code sample will look like this::
  32. class AClass
  33. {
  34. ...
  35. }
  36. //A Comment
  37. $obj = new AClass($arg1, $arg2, ... );
  38. /* A note about another way of doing something
  39. $obj = AClass::newInstance($arg1, $arg2, ... );
  40. */
  41. The presence of 3 dots ``...`` in a code sample indicates that we have left
  42. out a chunk of the code for brevity, they are not actually part of the code.
  43. We will often place multi-line comments ``/* ... */`` in the code so that we
  44. can show alternative ways of achieving the same result.
  45. You should read the code examples given and try to understand them. They are
  46. kept concise so that you are not overwhelmed with information.
  47. History of Swift Mailer
  48. -----------------------
  49. Swift Mailer began back in 2005 as a one-class project for sending mail over
  50. SMTP. It has since grown into the flexible component-based library that is in
  51. development today.
  52. Chris Corbyn first posted Swift Mailer on a web forum asking for comments from
  53. other developers. It was never intended as a fully supported open source
  54. project, but members of the forum began to adopt it and make use of it.
  55. Very quickly feature requests were coming for the ability to add attachments
  56. and use SMTP authentication, along with a number of other "obvious" missing
  57. features. Considering the only alternative was PHPMailer it seemed like a good
  58. time to bring some fresh tools to the table. Chris began working towards a
  59. more component based, PHP5-like approach unlike the existing single-class,
  60. legacy PHP4 approach taken by PHPMailer.
  61. Members of the forum offered a lot of advice and critique on the code as he
  62. worked through this project and released versions 2 and 3 of the library in
  63. 2005 and 2006, which by then had been broken down into smaller classes
  64. offering more flexibility and supporting plugins. To this day the Swift Mailer
  65. team still receive a lot of feature requests from users both on the forum and
  66. in by email.
  67. Until 2008 Chris was the sole developer of Swift Mailer, but entering 2009 he
  68. gained the support of two experienced developers well-known to him: Paul
  69. Annesley and Christopher Thompson. This has been an extremely welcome change.
  70. As of September 2009, Chris handed over the maintenance of Swift Mailer to
  71. Fabien Potencier.
  72. Now 2009 and in its fourth major version Swift Mailer is more object-oriented
  73. and flexible than ever, both from a usability standpoint and from a
  74. development standpoint.
  75. By no means is Swift Mailer ready to call "finished". There are still many
  76. features that can be added to the library along with the constant refactoring
  77. that happens behind the scenes.
  78. It's a Library!
  79. ---------------
  80. Swift Mailer is not an application - it's a library.
  81. To most experienced developers this is probably an obvious point to make, but
  82. it's certainly worth mentioning. Many people often contact us having gotten
  83. the completely wrong end of the stick in terms of what Swift Mailer is
  84. actually for.
  85. It's not an application. It does not have a graphical user interface. It
  86. cannot be opened in your web browser directly.
  87. It's a library (or a framework if you like). It provides a whole lot of
  88. classes that do some very complicated things, so that you don't have to. You
  89. "use" Swift Mailer within an application so that your application can have the
  90. ability to send emails.
  91. The component-based structure of the library means that you are free to
  92. implement it in a number of different ways and that you can pick and choose
  93. what you want to use.
  94. An application on the other hand (such as a blog or a forum) is already "put
  95. together" in a particular way, (usually) provides a graphical user interface
  96. and most likely doesn't offer a great deal of integration with your own
  97. application.
  98. Embrace the structure of the library and use the components it offers to your
  99. advantage. Learning what the components do, rather than blindly copying and
  100. pasting existing code will put you in a great position to build a powerful
  101. application!