The Mailer

The mailer class, Swift_Mailer is the central class in the library where all of the other components meet one another. Swift_Mailer acts as a sort of message dispatcher, communicating with the underlying Transport to deliver your Message to all intended recipients.

If you were to dig around in the source code for Swift Mailer you'd notice that Swift_Mailer itself is pretty bare. It delegates to other objects for most tasks and in theory, if you knew the internals of Swift Mailer well you could by-pass this class entirely. We wouldn't advise doing such a thing however – there are reasons this class exists:
  • for consistency, regardless of the Transport used
  • to provide abstraction from the internals in the event internal API changes are made
  • to provide convenience wrappers around aspects of the internal API

An instance of Swift_Mailer is created by the developer before sending any Messages.

NOTE: Documentation for version 3 is in the wiki.