Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Issue with email verification setup

the mail() function

Moderators: macek, egami, gesf

Issue with email verification setup

Postby Luki » 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.

Thanks,
$webmaster";

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:

smtp_server=smtp.gmail.com - or this should be localhost?
; smtp port (normally 25)
smtp_port=587
sendmail_from = myemail@gmail.com

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.
Luki
New php-forum User
New php-forum User
 
Posts: 16
Joined: Wed Feb 08, 2012 8:01 am

Re: Issue with email verification setup

Postby freshnet » 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.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.