I use XAMPP lite 2.5 USB version, and the thing i hate about it is that i cannot test email notification in my WordPress install. This is very crucial to test eCommerce site so i can meke sure the system deliver email to user, or in bbPress to check user subscription is working, and you can also be creative and use it for a very simple email newsletter, etc.
I used to create a live test site just to check this. But not anymore since i found this tutorial How to send email from XAMPP (PHP).
However the tutorial is not working, maybe it’s different XAMPP version. This is the working code i’m using:
Edit your php.ini in “xampp\php\php.ini”
And change this in line 1086:
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = postmaster@localhost ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path ;sendmail_path = "\"\XAMPP\sendmail\sendmail.exe\" -t"
to:
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 587 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = {your gmail username}@gmail.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "\"\XAMPP\sendmail\sendmail.exe\" -t"
Change {your gmail username}
with your own without the bracket.
Edit your sendmail.ini “xampp\sendmail\sendmail.ini”
comment this two line (just add “;” before it)
smtp_server=localhost smtp_port=25
to
;smtp_server=localhost ;smtp_port=25
and add this in the bottom of your sendmail,ini:
;new config: smtp_server=smtp.gmail.com smtp_port=587 smtp_ssl=tls error_logfile=error.log pop3_server= pop3_username= pop3_password= force_recipient= hostname= auth_username={your gmail username}@gmail.com auth_password={your gmail password} force_sender={your gmail username}@gmail.com
How to enable smtp gmail ? Please help. Thanks
go to your gmail settingsm click forwarding pop/imap. imap is the smtp, just enable imap.
Sir, once i run localhost, it said successful..but i didnt receive any email..i have setting the enable imap…i dont know know how to fix this..do you have any suggestion regarding my problem?
Sorry, I no longer activate email in XAMPP.
I don’t know if it’s working/not in latest XAMPP.
I would suggest using the xampp version as described in my post.
Good luck 🙂
I’ve done all steps. But no email received in my gmail account.. And also there is no error
i manage to send email by using gmail to another email..my question is how to make auto reply email to sender from email..eg i send email from [email protected] to [email protected] then from [email protected] it will reply back to [email protected] but the problem is at the ‘From’ it write from [email protected] not from [email protected] how to setup if i have my own dmoain email??thanks
I’m running into the same problem. This script runs great, but I wrote a program that allows the client to type in their own email address and share the content with another email address. So I set up this up using [email protected], went to my app and chose to send from [email protected] to [email protected]. When [email protected] checks their inbox, they can only reply to [email protected] instead of the [email protected] that it was actually supposed to send from. It says “Reply-to: [email protected]” in the information box on the email, but clicking on reply will queue up a reply to [email protected]
I followed your steps but mail is not sending please help me
$to=”[email protected]”;
$subject=”hai”;
$body=”hello”;
if(mail($to,$subject,$body))
echo “Successful”;
else
echo “Unsuccessful”;
help me do this.
I tried editing these sendmail.ini and php.ini in many ways but none of them worked… I failed everytime sending mail…
The mails are being stored in mailoutput folder… please help me to sort this out
Hello, my website is http://prashantmantra.com I want to use email validation in sign up form but problem is that email is not sending out to gmail. Can you tell me how to configure smtp in remote server how to solve it…..?
Hello, my website is http://prashantmantra.com I want to use email varification in sign up form but problem is that email is not sending out to gmail. Can you tell me how to configure smtp in remote server how to solve it…..?
this is good guidance but event when i enable IMAP in gmail it did not work
it did not work for me eider … 🙁
what are the values to be given for
pop3_server=
pop3_username=
pop3_password=
force_recipient=
hostname=
Please help ASAP… I am working on it present..
i just left it empty.
Thank you David for this!
smtp_ssl=tls was my problem, in my ini was set to auto.
not work for me…huhu..
How to enabled the SMTP in gmail ?
Still not worked…yaar..!!!!!!!!!!
I am also changed my php.ini file as well as sendmail.ini but every time smtp error found and i can’t send mail through localhost..please help me..!!
have tried but not working, defined all the configs as required, anyone has a solution?
This work good for me, but i have receive email only from gmail, not from email that i entered. just like hajar problem. is there any solution??
hey ircham….
i am not getting mail too for my contact form…i have changd php.ini and sendmail.ini then too
same as david has given..
please hellp me
Worked perfectly for me! Many Thanks!!!!
hello…can u help me? i had followed the steps..but cant receive the mail from localhost… 🙁
its works 🙂 thanks
hey sam….
i am not getting mail too
its showing mail is sent but i am not getting mail
please hellp me
its work for me
I used xampp-win32-1.7.7-VC9 with sendmail from this site http://glob.com.au/sendmail/
Thanks
It’s not working! Don’t fool us!!
Could not open socket
How to solve it?
its too tough… not done
Mail Sending Problem not Recive Mail???? why?
Output: mail sent successfully
but not recieved…
Not working.. it takes so many time to run..
error log
[Fri Oct 02 02:29:45.721906 2015] [mpm_winnt:notice] [pid 5948:tid 508] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Fri Oct 02 02:29:45.721906 2015] [core:notice] [pid 5948:tid 508] AH00094: Command line: ‘d:\\www\\xampp\\apache\\bin\\httpd.exe -d D:/www/xampp/apache’
[Fri Oct 02 02:29:45.721906 2015] [mpm_winnt:notice] [pid 5948:tid 508] AH00418: Parent: Created child process 1924
[Fri Oct 02 02:29:46.249086 2015] [ssl:warn] [pid 1924:tid 512] AH01909: http://www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 02 02:29:46.452220 2015] [ssl:warn] [pid 1924:tid 512] AH01909: http://www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 02 02:29:46.499103 2015] [mpm_winnt:notice] [pid 1924:tid 512] AH00354: Child: Starting 150 worker threads.
Sending HTML email using PHP
<?php
$to = "[email protected]";
$subject = "This is subject";
$message = "This is HTML message.“;
//$message .= “This is headline.”;
$header = “From: [email protected]“;
echo “Sending test mail to $to …………………………”;
if(mail($to,$subject,$message))
echo “Successful”;
else
echo “not Successful ………..”;
$retval = mail ($to,$subject,$message,$header);
if( $retval == true )
{
echo “Message sent successfully… $retval”;
}
else
{
echo “Message could not be sent… $retval”;
}
?>
After run:
Sending test mail to [email protected]
………..
……….
………
not Successful
………..
Message could not be sent…
its not workingg
I try to send email form localhost to gmail but it cant not send help me anyone. My php code is :
$mail = new PHPMailer(true);
$email = ‘[email protected]’;
$name = ‘Zeeshan’;
$email_from = ‘[email protected]’;
$name_from = ‘Ghafoor shah’;
//Send mail using gmail
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = “ssl”; // sets the prefix to the servier
$mail->Host = “smtp.gmail.com”; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = “[email protected]”; // GMAIL username
$mail->Password = “password”; // GMAIL password
//Typical mail data
$mail->AddAddress($email, $name);
$mail->SetFrom($email_from, $name_from);
$mail->Subject = “My Subject”;
$mail->Body = “Mail contents”;
try{
$mail->Send();
echo “Success!”;
} catch(Exception $e){
//Something went bad
echo “Fail :(“;
}
no comments, simply waste.
Enable IMAP on your mail i.e.
Open Computer -> Your Mail -> Click Settings -> Click Forwarding & POP/IMAP tab.
In the “IMAP access” section, select Enable IMAP.
Click Save Changes.