Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Sending Emails in PHP with PHPMailer
Apr 27, 2015 @ 17:53:56

The SitePoint PHP blog has a tutorial from Narayan Prusty showing you how to effectively use PHPMailer to send emails from your PHP application. PHPMailer provides a simplified interface to send both simple and complex emails.

PHPMailer is one of the most popular open source PHP libraries to send emails with. It was first released way back in 2001 and since then it has become a PHP developer’s favorite way of sending emails programmatically, aside from a few other fan favorites like Swiftmailer. In this article we’ll talk about why you should use PHPMailer instead of PHP’s mail() function and we’ll show some code samples on how to use this library.

He starts by answering the obvious question - is it an alternative to PHP's own mail function? He describes the differences, mostly in the way of enhanced functionality PHPMailer offers. He then helps you get it installed via Composer and how to send a first simple email. Next up he shows how to send an email with attachments and connecting the library to an external SMTP server for sending. The tutorial finishes with a quick mention of using POP3 to read emails and how to show local error messages when something goes wrong.

tagged: tutorial send email phpmailer library simple attachment smtp pop3 error

Link: http://www.sitepoint.com/sending-emails-php-phpmailer/


Trending Topics: