Issue with email verification setup

the mail() function

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 16
Joined: Wed Feb 08, 2012 8:01 am

Sat Mar 24, 2012 9:16 am

Hi All ,

I wish to have email verification process: I mean, once 'user' is registered is getting email verification with username and password and so on.
Want to have and run on localhost for testing purposes.

$youremail = 'email';

$subject = "You have successfully registered at $yoursite...";
$message = "Dear $firstname, you are now registered at our web site.
To login, simply go to our web page and enter in the following details in the login form:
Username: $username
Password: $password

Please print this information out and store it for future reference.


mail($email, $subject, $message, "From: $firstname <$email>\nX-Mailer:PHP/" . phpversion());

echo "Your information has been mailed to your email address.";

Now , I have enabled windows xp smtp server.Set my ip address and is running away.

php.ini file: - or this should be localhost?
; smtp port (normally 25)
sendmail_from =

Once user registered getting the good all knowing 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:\Apache2.2\htdocs\register_check.php on line 77

Have spend all day , trying different things.. no luck..Thanks.

User avatar
php-forum Active User
php-forum Active User
Posts: 365
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Sat Mar 24, 2012 11:44 am

to send mail from your gmail account you'll also need your mail password. I would suggest trying with localhost instead (assuming that you have SMTP service running in Windows). This won't be a great idea in production, but it will at least let you find out if your configuration is good or not.

Post Reply