problem with connecting to mailserver at localhost

Problems with the Windows version of XAMPP, questions, comments, and anything related.

problem with connecting to mailserver at localhost

Postby ravi2007 » 26. April 2010 19:52

i am developing a website in xampp 1.72 and the problem is when i am trying to add a new user to my database in the addUser.php , after submitting i am getting the following error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Vital31\admin\newUser.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Vital31\admin\newUser.php:34) in C:\xampp\htdocs\Vital31\admin\newUser.php on line 35

but when i check my database in mySql , the user has been added perfectly but now when i tried logging in as the user with the temperory password provided by the admin, i cannot login.
i havent hosted my site in internet as it is still under development and hence,running on localhost alone.

is there any way to solve my problem without connecting to internet as during my project presentation, i wont have a working internet connection to connect to internet and hence have to show the complete working on localhost alone.
i read through many posts on this forum and other sites as well but all are saying to install a mail server and then connect to internet but xampp has already provided me with the mercury mailserver.
please help me out...i am posting the code here and havent made any changes in my php.ini and sendmail.ini file yet :


$query="insert into user_details(firstName, middleName, lastName, age, gender, dateOfBirth, contact1, contact2, personalEmail, companyEmail, permanentAddress, localAddress, qualification, dateOfJoining) values('".$_POST[firstName]."', '".$_POST[middleName]."', '".$_POST[lastName]."', '".$_POST[age]."', '".$_POST[gender]."', '".$dateOfBirth."', '".$_POST[contact1]."', '".$_POST[contact2]."', '".$_POST[personalEmail]."', '".$_POST[companyEmail]."', '".$_POST[permanentAddress]."', '".$_POST[localAddress]."', '".$_POST[qualification]."', '".$dateOfJoining."')";


$query="insert into user_login(userId, password) values('".$_POST[userId]."', '".$_POST[password]."')";


if($result1 && $result2)
$to = "$_POST[personalEmail]";
$subject = "Your Account @ site";
$message = "Account Details :
Company Email Id : $_POST[companyEmail]
User Id : $_POST[userId]
Temporary Password : $_POST[password]";
$headers = "From:";
$message = wordwrap($message2, 70);
Posts: 9
Joined: 13. October 2009 18:58

Re: problem with connecting to mailserver at localhost

Postby MC10 » 27. April 2010 05:10

I believe that it is your mail problem. Can you show the relevant parts of your php.ini?
Posts: 148
Joined: 20. February 2010 20:13

Re: problem with connecting to mailserver at localhost

Postby ravi2007 » 27. April 2010 16:23

here is the php.ini file
(i havent changed anything in it)

NOTE: this code is working fine in wamp 2.0 and i get a confirmation msg of "user successfully addded" but the user login is still not possible in wamp too and i want to stick to the xampp

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = postmaster@localhost

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"
Posts: 9
Joined: 13. October 2009 18:58

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 52 guests