Email

  1. Home
  2. Computing & Technology
  3. Email

How to Configure PHP to Use a Remote SMTP Server for Sending Mail

By Heinz Tschabitscher, About.com

PHP makes it easy to send mail from Web applications. But it still needs a bit of configuration. As you probably know, PHP configuration happens php.ini.

The relevant section for email configuration is [mail function], and to make PHP use an external mail server you must set SMTP to your ISP's mail server's address. This will be the same address that you use in your email program for the outgoing mail server, "smtp.isp.net", for example. The other setting sendmial_from, which specifies the default email address PHP emails are sent from.

Configure PHP to Use a Remote SMTP Server for Sending Mail

Note that setting up the internal mail function to use SMTP is only available on Windows. On other platforms, PHP should use the locally available sendmail or sendmail drop-in just fine. Alternatively, you can use the PEAR Mail Package.

A typical configuration might look like:

[mail function]
SMTP = smtp.isp.net
sendmail_from = me@isp.net

More Email Quick Tips

Explore Email

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Email

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

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

All rights reserved.