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

hello,
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 :

newUser.php

$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."')";

$result1=mysql_query($query);

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

$result2=mysql_query($query);

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: example@yahoo.com";
$message = wordwrap($message2, 70);
mail($to,$subject,$message,$headers);
header('location:viewUser.php?result=success');
}
else
{
header('location:viewUser.php?result=failure');
}
ravi2007
 
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?
MC10
 
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.
; 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 = "\"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"
ravi2007
 
Posts: 9
Joined: 13. October 2009 18:58


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 112 guests