Home arrow PHP arrow Introducing Swift Mailer

Introducing Swift Mailer

Do you want to build a complex email program in PHP that offers more control than the language's native "mail()" function? You may want to consider using the Swift Mailer email library. This multi-part series will walk you through some of its most useful features.

TABLE OF CONTENTS:
  1. Introducing Swift Mailer
  2. Start using Swift Mailer
  3. Creating mailer and message objects
  4. Sending an email message with the send() method
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
February 10, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

If you’ve been developing web applications with PHP for a while, then you’ll surely know that the language offers a couple of options that allow you to send email messages in a pretty straightforward way. Undoubtedly, the easiest thing to do is to create email scripts by means of the “mail()” native function. That allows you to avoid having to deal directly with the internals of the SMTP protocol itself, thus making the entire creation process much more approachable.

Logically, these benefits come at a cost. The major down side in using this function is the lack of more accurate control as to how emails are sent out, not to mention a few incompatibilities that exist when working with different operating systems.

On the other hand, it’s possible to build email programs by using the functions that come with the PHP socket extension. This is by far a more complex procedure; in that case it's not only necessary to get a more intimate background in many of the commands supported by the SMTP protocol, but also a solid understanding of how to manipulate TCP sockets.

Of course, this last option is the best one when it comes to developing full-featured email applications -- but it offers a steep learning curve that many programmers are reluctant to follow. However, there’s no need to reinvent the wheel each time you need to build this kind of application. There are a few useful third-party email libraries available nowadays that will let you accomplish this in a truly effortless way.

In my personal opinion, one of the best email libraries that can be found today is Swift Mailer, a powerful package developed by Chris Corbin that allows you to  quickly develop email programs. With Swift Mailer, you use a strict object-oriented approach in conjunction with a solid base of dependencies that “talk” directly to SMTP servers.

Indeed, Swift Mailer offers plenty of handy features that permit you to perform all sort of clever tasks when sending email, such as manipulating MIME headers with ease, handling attachments, formatting messages in HTML and much, much more.

Therefore, in this series of articles I’m going to take a deeper look at this library, so you can start using it within your own PHP applications. Of course, this will be only an introductory guide to working with the library’s most relevant features. The best place to look for more thorough documentation is its official user guide, which is also very easy to follow.

Now, it’s time to start leveraging the real power behind Swift Mailer. Let’s go!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: