Send email from xampp localhost
Send email from xampp localhost. Follow the easy steps
- Goto http://glob.com.au/sendmail/, download latest sendmail package.
- Extract the zip file and copy the files into your \xampp\sendmail folder(Replace every file in the existing folder).
-
Update the sendmail.ini file in sendmail folder with the following details, and make sure it is not commented(;).
smtp_server=smtp.gmail.com smtp_port=25 error_logfile=error.log debug_logfile=debug.log auth_username=yourname@gmail.com auth_password=gmailpassword force_sender=yourname@gmail.com
Here i have added gmail account for sending emails.
-
Open xampp\php\php.ini file find sendmail_path and update its value to
"\"C:\xampp\sendmail\sendmail.exe\" -t". Now it will look like belowsendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Make sure it’s not commented(;)
- Restart your apache server.
Now you can send email from xampp localhost! enjoy










Nice post! now i can able to send email from localhost. It ll help me to check email notifications to users after registration. Thank you karthik
Thanks for your comment sam:)
great post it solved my problem that arises during my project work
Hi thanks for the PHP mail post its so clearly explaianed in,
I am having issues receiving the mails sent from localhost, on my localhost the mailform.php is executed successfully without any error messages but unfortunately I am not receiving the same. Plz do the needful
Hi Raj, please make sure that you have entered correct email and password, check your log files in sendmail folder to find what would be the problem
Hello Karthik,
I had done all the settings which were mentioned above but while sending the email, it shows that the mail have been sent but sent email address does’t recieve any email from the sent mail….
Can you explain why it had dappened…?
Hi sunil, please check your debug.log and error.log file in sendmail folder to fine the error.
I’ve tried all your steps. I’ve checked “error.log” and “debug.log” and its blank. No error found.
This is my php code:
—————————————————————
$from = FROM_EMAIL;
$to = TO_EMAIL;
$subject = FHD_TITLE . ‘ New Registration’;
// message
$message = ‘
New Registration
New User Registration
Name: ‘ . $name . ‘
Login: ‘ . $login . ‘
Email: ‘ . $email . ‘
‘;
$headers = “From:” . $from . “\r\n”;
$headers .=”Reply-To: ” . $from . “\r\n”;
$headers .=”MIME-Version: 1.0″ . “\r\n”;
$headers .=”Content-type: text/html; charset=iso-8859-1″ . “\r\n”;
if (mail($to, $subject, $message, $headers))
{
echo “Message Sent”;
}
else
{
echo “Message Sending Failed”;
}
Message appear on the page is “Message Sent”. But no incoming email received.
Can you help me with this?
Hi Can someone help me, I followed all the steps, But it’s not working for me, Here’s the content on my debug and error file:
Error: 13/04/27 08:53:06 : Connect timed out.
Debug:
13/04/27 08:52:56 ** — MESSAGE BEGIN —
13/04/27 08:52:56 ** To: bbmanalaysay@gmail.com
13/04/27 08:52:56 ** Subject: This is subject
13/04/27 08:52:56 ** From:abc@somedomain.com
13/04/27 08:52:56 **
13/04/27 08:52:56 ** This is simple text message.
13/04/27 08:52:56 ** — MESSAGE END —
13/04/27 08:52:56 ** Connecting to smtp.gmail.com:25
13/04/27 08:53:06 ** Disconnected.
13/04/27 08:53:06 ** Disconnected.
13/04/27 08:53:06 ** Disconnected.
13/04/27 08:53:06 ** Disconnected.
13/04/27 08:53:06 ** Connect timed out.
Hi, Benjie Brian Manalaysay , i got the same error. After soo much of experiment it worked
This is my sendmail.ini
———————————————————————————————–
; configuration for fake sendmail
; if this file doesn’t exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail
[sendmail]
; you must change mail.mydomain.com to your smtp server,
; or to IIS’s “pickup” directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS’s pickup directory cause sendmail to
; run quicker, but you won’t get error messages back to the calling
; application.
smtp_server=smtp.gmail.com
; smtp port (normally 25)
smtp_port=25
; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL
smtp_ssl=auto
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn’t provided
; if you want to override the value in the registry, uncomment and modify
;default_domain=mydomain.com
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=error.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
debug_logfile=debug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=yourid@gmail.com
auth_password=yourpassword
; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines. do not enable unless it is required.
pop3_server=
pop3_username=
pop3_password=
; force the sender to always be the following email address
; this will only affect the “MAIL FROM” command, it won’t modify
; the “From: ” header of the message content
force_sender=
; force the sender to always be the following email address
; this will only affect the “RCTP TO” command, it won’t modify
; the “To: ” header of the message content
force_recipient=
; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required
hostname=
————————————————————————–
Happy mailing
Ch3tan
I think you could try changing the smtp_port:25 in senmail.ini file to smtp_port:587