HomePHP Using Sendmail and Mail() with Swift Mailer
Using Sendmail and Mail() with Swift Mailer
In this third part of the series, I explain how to configure Swift Mailer to work seamlessly with the “sendmail” Unix program and the “mail()” PHP function. This process is extremely straightforward, so you shouldn’t have any trouble understanding how it functions.
Among the great variety of PHP-based email libraries available nowadays, there's one that might be particularly attractive to you. It offers a flat learning curve and impressive features, which have been implemented by using a strict object-oriented approach.
In this specific case, of course, I'm talking about Swift Mailer, a powerful package developed by Chris Corbin that you can download at http//swiftmailer.org. It allows you to send email messages in a truly painless fashion using a myriad of SMTP transports and additional options, such as easily handling attachments, formatting messages in HTML, and much more.
So, if you're tired of using your old email libraries over and over again and want to give a face-lift to your developer's toolbox, then start learning how to put Swift Mailer to work for you.
And now that you have a clearer idea of the things that Swift Mailer can do to help you build email applications in PHP 5, it's time to review the topics that were discussed in the last tutorial. In that part of the series I explained how to utilize different SMTP transports within the same script for dispatching a basic email message by means of the "setHost()" and "setPort()" method provided by the library.
This particular example undoubtedly speaks for itself about the flexibility offered by Swift Mailer, but there are other options provided by the library that need to be explored. These include choosing which transport to use for sending email.
Thus, in this third installment of the series, I'm going to explain how to use the "sendmail" Unix application and the "mail()" PHP native function respectively with Swift Mailer, in order to create a couple of simple email scripts that you'll grasp quickly.
Now, it's the time to continue discovering the real power of the Swift Mailer library. Let's get going!