How to send email from xampp localhost

Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 579 of /home/respons9/public_html/includes/
By Ujjwal Jha
May 29, 2015 16:39

For send email from xampp localhost you update these two files.

1.) sendmail.ini 

2.) php.ini 


Step.1 )

Open sendmail.ini file from your xammp sendmail folder and update its value to




Note: Please check these lines are not commented(remove ';').


Step.2 )

Open xampp\php\php.ini file find sendmail_path and remove the comment on these lines.

"\"C:\xampp\sendmail\sendmail.exe\" -t".


Step.3 )

Restart your apache server.

Now you can send email from xampp localhost! enjoy :-)


Below the Php mail codes.


$to      = '';

$subject = 'Testing Mail';

$message = 'Hello I am testing mail from localhost';

$headers = 'From:'; // here email id is only for show it works from sendmail.ini file

if(mail($to, $subject, $message, $headers)){

print "Mail working well";


print "Mail not working well";



Also Please Turn On this gmail settings.

Tags: How To

Add new comment

Contact Us