Email, Messaging, & Video Calls Email How to Configure PHP to Use a Local Mail Server for Sending Mail Configure mail settings in php.ini to use a local server by Heinz Tschabitscher Writer A former freelance contributor who has reviewed hundreds of email programs and services since 1997. our editorial process Heinz Tschabitscher Updated on April 29, 2020 Astronaut Images / Getty Images Email Yahoo! Mail Gmail Tweet Share Email For mail functions to be available in PHP, you must have a working email system already installed. Then, you define the email configuration settings in the php.ini file. It's easy to send mail directly from PHP scripts, but you need the right configuration in php.ini for it to work, If you run PHP on Unix or 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 it 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). How the Configuration Should Appear Your configuration should look like this: [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.