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