Sendmail ldap how to do it

Email from web site @ localhost

PHPsendmail configure in a XAMPP installation


In order to test the functionality of, for example, contact messages or user comments via the PHP sendmail function from the local web server before publication, XAMPP must be configured.

We'll show you what to do.

The challenge

The entire project environment of a website consists of three parts: the development environment (i.e. a local working directory somewhere in the file system), the test environment (a local web server; localhost) and the production environment (the remote web servers on the WWW that visitors ultimately access). The workflow is designed as follows: develop, publish and test localhost, publish on the website's web server.

We set up the test environment, the local web server, with XAMPP.

Web pages like to use the PHP function sendmail to send user input or automated messages to the web administrator or content manager. To do this, web servers use functions provided by web hosting platforms. Do you already have at least one email account with a provider that you use for this? Then that's no problem: it works!

This is different for your local web server: The sendmail function must first be configured. Here we show you how to configure the sendmail function in the XAMPP environment.

The work flow

Four steps are necessary:

  1. 1. Provision of the access data for a suitable SMTP e-mail account
  2. 2. Adjust the php.ini in »xampp \ php \ php.ini«
  3. 3. Adjust the sendmail.ini in »xampp \ sendmail \ sendmail.ini«
  4. 4. If necessary, set the execution rights for the /xampp/sendmail/sendmail.exe file

Important note on point 4: Set execution rights under Windows 8!

We have received a number of requests from users who seem to have been able to send their emails successfully under Windows 8 but have not received any.

Under Windows 8 (possibly also with older versions), the execution rights for the XAMPP program sendmail.exe must also be set. We explain how to do this further down at the end of this description. Now you have to get the access data and adjust the ini files.

1. Setup or provision of the email account

It is advisable to set up a separate email address for this purpose. Most web hosts offer numerous, freely assignable e-mail accounts in addition to the web space with the URLs. Use one for news from the test environment of your web projects.

Make a note of the access data. You need:

  • the SMTP address
  • the SMTP port number
  • the login data (email address, password)


2. Adjust the php.ini in »xampp \ php \ php.ini«

Create a backup copy of the file »xampp \ php \ php.ini« under a new name (e.g. »xampp \ php \ php.ini.bup«).

In the “xampp \ php \ php.ini” file, find the section that begins with “[mail function]”. Make the following adjustments:

Note: The light gray comment lines are used for explanation at this point and cannot be found in your original file. The red parts of the text must be adapted.

Tip: rewrite lines that you want to change! Leave the original lines, just comment them out by placing a semicolon (";") at the beginning of the line.

[mail function]; Enter the SMTP address of the provider of your e-mail account; SMTP = localhost SMTP = smtp.domain; Enter the specified SMTP port number; smtp_port = 25 smtp_port = port number; Enter the sender name, ideally this is the name of the account sendmail_from = Website @ localhost; If the e-mail is to be sent to an e-mail account,; activate this line (remove comment characters):; sendmail_path = »\« \ xampp \ sendmail \ sendmail.exe \ «-t«; If instead the e-mail just simply goes to the local directory; \ xampp \ mailoutput should be written to hard disk; activate this line (remove comment characters) :; sendmail_path = "\ xampp \ mailtodisk \ mailtodisk.exe"

3. Adapt the file »xampp \ sendmail \ sendmail.ini«

Create a backup copy of the "xampp \ sendmail \ sendmail.ini" file under a new name (e.g. "xampp \ sendmail \ sendmail.ini.bup").

In the "xampp \ sendmail \ sendmail.ini" file, find the section that begins with "[sendmail]". Make the following adjustments:

[sendmail]; you must change to your smtp server,; So insert the actual SMTP address here: smtp_server =smtp.domain ; smtp port (normally 25); Insert the actual SMTP port number here: smtp_port =port number ; default_domain =; Insert the actual domain name here: default_domain ; if your smtp server requires authentication,; modify the following two lines; Enter the values ​​here if the account requires authentication,; then delete the leading comment characters ";" :; auth_username = {only if requested by the provider}; auth_password = {only if requested by the provider}; if your smtp server uses pop3 before smtp authentication, modify the; following three lines. do not enable unless it is required. ; Only use values ​​if requested by the provider !; pop3_server = {pop3 address of the provider}; pop3_username = {account email address}; pop3_password = {account password}; force the sender to always be the following email address; If you like the sender to be unique :; force_sender = {email address of the desired account}

4. Function test and documentation

Finished! You can now test the newly set up e-mail function:

  • Set up the e-mail account in your e-mail client (e.g. Microsoft Outlook) in order to be able to receive the e-mails.
  • Restart XAMPP and the local Apache web server.
  • Go to your local web page.
  • Test the sendmail function using a form on your website.
  • If everything works, make a note of and describe your personal adjustments in the two files in a separate file that you keep outside of the XAMPP installation. This ensures that you can quickly and easily make any necessary adjustments in the future (e.g. for updates to the XAMPP system).

Set execution rights for sendmail.exe under Windows

Under Windows XP, Windows Vista and Windows 7, the procedure described (configuring the ini files) should already be successful. This is different under Windows 8. E-mails sent may not reach the recipient.

If this is the case for you, you should change the execution rights of the sendmail.exe program.

The following are to be set: »Compatibility mode Windows XP SP3« and »Run as administrator«. It works like this:

  • Find the program sendmail.exe in the xampp / sendmail / directory
  • Right click -> »properties«Select
  • In the tab »compatibility" the button "Change settings for all users" to press
  • In The Field "Compatibility mode«Tick the box.
  • In the list "Windows XP (Service Pack 3)" choose.
  • In The Field "Settings" the entry "Run the program as administrator«Click
  • All changes with the button »Take" to confirm.

You should then be able to send and receive emails.



To activate the PHP sendmail function in the Apache server, four steps were necessary:

  • Provision of the access data for a suitable SMTP e-mail account
  • Adjusting the php.ini in »xampp \ php \ php.ini«
  • Adjust the sendmail.ini in "xampp \ sendmail \ sendmail.ini"
  • If necessary, set the execution rights for the /xampp/sendmail/sendmail.exe file

If the e-mail account is with a service provider, you can e.g. For example, you can use Microsoft Outlook to set up an e-mail account in which you can collect the messages.

Have fun with "Email from web site @ localhost«!


Text | Graphic | Web design | Layout:

© by Reiner Makohl |

SK version 01/29/2021 ●