HomePHP Using Different SMTP Transports with Swift Mailer
Using Different SMTP Transports with Swift Mailer
In this second part of the series, I develop a couple of examples that demonstrate how easy it is to send email messages by using different SMTP servers, thanks to the versatility provided by the Swift Mailer PHP library.
In case you still haven't heard about it, Swift Mailer is a powerful object-oriented PHP library written by Chris Corbin and available at http://swiftmailer.org. It allows you to develop email applications in a truly effortless fashion by means of a set of comprehensive and well-structured classes that simplify the whole development process.
What's more, one of the strongest points of Swift Mailer is its clever implementation of popular software design concepts. These include the proper use of the Factory pattern, object aggregation and method chaining, all features that make this library the choice of many PHP developers nowadays.
So, if you're searching for a friendly guide that shows you how to take advantage of the numerous capabilities offered by Swift Mailer for sending email with PHP 5 the easy way, then start reading this series of articles right now!
Naturally, if you already had the chance to look at the first part of the series, then you already have a pretty clear idea of how to send basic email messages with Swift Mailer. In that tutorial I first explained how to use it to create a fictional SMTP transport, then to build a mailer object, and finally to dispatch a text message via its "send()" method. It was that simple, really.
Nevertheless, as I said before, Swift Mailer comes packaged with many other useful features that are worth looking at, including its ability to work with different email transports. In the next few lines I'm going to show you how to send email using both local SMTP and remote servers, so you can choose the option that best suits your needs.
Ready to continue this hopefully instructive tour of the Swift Mailer library? Then let's get started!