1. Home
  2. Computing & Technology
  3. Email

How to Configure PHP to Use a Local Mail Server for Sending Mail

By , About.com Guide

It's easy to send mail from PHP scripts. For it to work you still need the right configuration in php.ini, however. If you run PHP on Unix or on Windows with a local mail server, you might want to take advantage of that server.

The relevant setting is in the [mail function] section of php.ini, and is called sendmail_path. It should be assigned the path to sendmail, typically /usr/sbin/sendmail or /usr/bin/sendmail (but check your system to get it right).

Configure PHP to Use a Local Mail Server for Sending Mail

Thus your configuration might look like:

[mail function]
sendmail_path = /usr/sbin/sendmail

If you use a different mail server, use its sendmail wrapper (var/qmail/bin/sendmail for qmail, for example).

Explore Email
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Email
  4. How Email Works
  5. Email Programming Tips
  6. How to Configure PHP to Use a Local Mail Server for Sending Mail - About Email

©2009 About.com, a part of The New York Times Company.

All rights reserved.