Nowadays, mail communication is common over mail in web applications. Those emails can be any type like notifications, OTP mails, password reset links, or just alert mails.
Sometimes, mail configuration can be harder than sending mail as a beginner. In this blog, we will set up mail and enable XAMPP to send mail using the PHP mail function.
In this configuration, we will allow the built-in XAMPP sendmail.exe binary to deliver emails using given credentials. We will achieve this objective in two steps. First set up send mail in PHP configuration and provide credentials to the sendmail application.
First of all, we will setup PHP to use Sendmail to handle mail functionality. Go to XAMPP's php directory and open php.ini (configuration file) for php. If you have default installation of XAMPP then location of php.ini file is below :
If you have customized or changed default location of XAMPP then open that directory and edit php.ini file.
Now, Open php.ini file into edit mode and search for sendmail_path. Replace or remove comment that line and provide Sendmail location like below example.
It will setup sendmail application to our PHP. This location can be different as per your installation so please check and update it.
In this step, we will setup our email configuration into our Sendmail application. Before performing this step please confirm mail configuration values like server address, port, username and password for your email.
Go to your XAMPP directory again and find the Sendmail directory. Open sendmail.ini file inside and find the sendmail portion.
Those values can be different if you are using another email server like yahoo, hotmail or any other.
Now our setup is complete. we just need to restart Apache server. After that we can use mail() function into our PHP web application.
In this tutorial, we have configured XAMPP to send mail using Sendmail application in two simple steps. Feel free to place comment if you have any query or suggestion.
Ask anything about this examples