News Feed
Sections




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

Arvind Bhardwaj's Blog:
How to Test PHP Emails on Localhost
June 09, 2012 @ 12:02:20

In this quick tutorial Arvind Bhardwaj shows a method for testing your scripts that need to send emails, but on your localhost system.

While developing web applications on localhost you must have always missed the functionality to send mails. As localhost does not support email service, so it has always been a bottleneck for email testing on localhost. But I have found a simple way to test emails on localhost using PHP. I have overridden the default mail() function of PHP to create a text/html file based on the email format. If the email is in html format, an HTML file is created otherwise a text file is created. You can see in this file what exactly is the content sent in your mail. See how does it work.

He shows how to override the mail function with your own custom "mail" function, just in a difference namespace. He includes the sample code to send the email (the "mail" function), a basic HTML template you can use and and example of it in use.

0 comments voice your opinion now!
mail localhost email tutorial testing


blog comments powered by Disqus

Similar Posts

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 10)

PHPEveryDay.com: New Tutorials Posted (Web Content/Networking)

Rob Allen's Blog: What problem does dependency injection solve?

PHPBuilder.com: Using cURL with PHP

Tim Koschuetzki's Blog: Parsing XML With The DOM Library


Community Events





Don't see your event here?
Let us know!


podcast introduction update composer voicesoftheelephpant symfony opinion framework library laravel series tool install release security language interview package community version

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework