loudog Posted June 16, 2011 Share Posted June 16, 2011 Hey guy's, Im working on how to verify an email address. i dont have my own web site so i keep getting the following errors: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:\wamp\www\GuestBook\signup_ac.php on line 40 and Undefined variable: sentmail in C:\wamp\www\GuestBook\signup_ac.php on line 49 . I've read that you can actually can don it without having you're on site. If anyone can show me how to do it or tell me what im doing wrong that would be awesome. thanks in advance loudog HERE is the code. page1 sginup.php <html> <head> </head> <body> <table width="350" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><form name="form1" method="post" action="signup_ac.php"> <table width="100%" border="0" cellspacing="4" cellpadding="0> <tr> <td colspan="3"><strong>Sign up</strong></td> </tr> <tr> <td width="76">Name</td> <td width="3">:</td> <td width ="305"><input type="text" name="name" id="name" size="30"></td> </tr> <tr> <td>E-mail</td> <td>:</td> <td><input type="text" name="email" id="email" size="30"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input type="password" name="password" id="password" size="30"></td> </tr> <tr> <td>Country</td> <td>:</td> <td><input type="country" name="country" id="country" size="30"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="sub" id="sub" value="Submit"> <input type="reset" name="reset" id="reset" value="Reset"></td> </tr> </table> </form></td> </tr> </table> </body> </html> page 2 signup_ac.php <?php include('config.php'); //table name $tbl_name='temp_members'; //Random confirmation code $confirm_code=md5(uniqid(rand())); //values sent from form $name=$_POST['name']; $email=$_POST['email']; $country=$_POST['country']; $password=$_POST['password']; //Insert Data into database //$sql="INSERT INTO $tbl_name(confrim_code,name,email,password,country)VALUES('$confirm_code','$name','$emailid','$pwd','$country')"; $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')"; $result=mysql_query($sql); //If suceesfully inserted data into database, send confirmation link to email if($result) { //Send e-mail to.. $to=$email; //Your subject $subject="Your confirmation link here"; //From $header="from:your name<your email>"; //Your message $message="Your confirmation link \r\n"; $message="Click on this link to activate your account \r\n"; $message="http://www.yourweb.com/confirmation.php?passkey=$confirm_code"; //send email this line 40->$sentemail=mail($to,$subject,$message,$header); } //If not found else{ echo "Not found your email in our database"; } //If your email succesfully sent this is line 49->if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address."; } else{ echo"Cannot send Confirmation link to your email Address."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/ Share on other sites More sharing options...
gristoi Posted June 16, 2011 Share Posted June 16, 2011 You probably havent set up your outgoing mail server on your localhost. I can see from your error you are on a windows machine using wamp. What you need to do is amend your php.ini file to allow for smtp(simple mail transfer protocol - outgoing mail). If you find your php.ini, look for SMTP. It will most likely be set to localhost ( smtp=localhost). Change this to your ISP's outgoing mail server address : i.e smtp.bt.com. Secondly search for smtp_port and make sure it says smtp_port = 25. restart your apache and retry. good luck Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230362 Share on other sites More sharing options...
loudog Posted June 16, 2011 Author Share Posted June 16, 2011 well that sound easy and i bet it is. but would you mind telling me how do i find SMTP in the php.ini file and amend it as well. in other words a step by step guide on how to set up a mail server would be appreciated. thanks in advance loudog Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230374 Share on other sites More sharing options...
gristoi Posted June 16, 2011 Share Posted June 16, 2011 I thought I was [pretty clear in my last post, but I'm not one the leave someone stranded lol. So here you go. Firstly left click on on the wamp icon in your system tray and select php from the menu, then php.ini from the sub menu: See attachment. this will open up the php.ini file in notepad. use control + F to search the document and search for [mail function]. This should show you the mail section of the document: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 change this to whatever your isp's outgoing mail server is: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.bt.com ; http://php.net/smtp-port smtp_port = 25 save the file and restart your wamp [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230382 Share on other sites More sharing options...
loudog Posted June 16, 2011 Author Share Posted June 16, 2011 i have changed the mail function and i still get the error why?????? this is the new setting below. [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = you@yourdomain Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230566 Share on other sites More sharing options...
gristoi Posted June 16, 2011 Share Posted June 16, 2011 you havent changed anything ! your smtp server still says localhost and your sendmail_from still says you@yourdomain. what exactly have you changed.? Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230570 Share on other sites More sharing options...
loudog Posted June 16, 2011 Author Share Posted June 16, 2011 I don't have internet i use wireless thru someone else in my apartment complex cuz its an unlocked connection. honestly i don't even know who it belongs to i just know that his internet provider is qwest. so i did the following and i still got the error. [mail function] ; For Win32 only. SMTP = qwest smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230797 Share on other sites More sharing options...
loudog Posted June 17, 2011 Author Share Posted June 17, 2011 I don't have internet i use wireless thru someone else in my apartment complex cuz its an unlocked connection. honestly i don't even know who it belongs to i just know that his internet provider is qwest. so i did the following and i still got the error. [mail function] ; For Win32 only. SMTP = qwest smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = [email protected] I have change the settings in the php,.ini file and i still get the damn error:Warning: mail() [function.mail]: Failed to connect to mailserver at "71.210.196.246" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\GuestBook\mail.php on line 7 New settings [mail function] ; For Win32 only. SMTP = 71.210.196.246 smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = [email protected] I still get the error Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230875 Share on other sites More sharing options...
wright67uk Posted June 17, 2011 Share Posted June 17, 2011 Have you spoken to your host? What mhost do you use? Have you tried using no port no. and leaving it to default? - (godaddy) Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230896 Share on other sites More sharing options...
loudog Posted June 17, 2011 Author Share Posted June 17, 2011 i don't have a host like godaddy or anything like that. all i have been trying is to configure the php.ini file tosend mail. Im starting to get to the point where i feel like unless i know the isp address there is no use to even configure that file. In other words i have to get a server from go daddy or somthing. RIght? Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230897 Share on other sites More sharing options...
loudog Posted June 17, 2011 Author Share Posted June 17, 2011 i use wamp and is under localhost. Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230898 Share on other sites More sharing options...
gristoi Posted June 17, 2011 Share Posted June 17, 2011 Ok, I think you are missing the point slightly. You do not use your ISP's I.P address as an email server. You use the ips's email server as an email server !!!!. Now as you stated: I don't have internet i use wireless thru someone else in my apartment complex cuz its an unlocked connection. honestly i don't even know who it belongs to i just know that his internet provider is qwest. so i did the following and i still got the error. So I am not going to give you the mail server settings for qwest as the connection is not owned by You, and if i found someone else using my internet connection as a mail server i wouldnt be too happy. But a quick google for qwest outgoing mail servers will point you in the right direction. But what i really advise is for you to go online an get yourself some hosting. All the setup info you need to get this working is in the previous posts i sent you, yet you have not followed the information correctly once. So PLEASE READ THE POST THOUROUGHLY before we start going round in circles. I am trying to help you as much as possible, but your not giving me much to work with Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230922 Share on other sites More sharing options...
harristweed Posted June 17, 2011 Share Posted June 17, 2011 put smtp server software on your local machine. It is much better to see exactly what you are sending. http://www.postcastserver.com/ Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1230928 Share on other sites More sharing options...
loudog Posted June 17, 2011 Author Share Posted June 17, 2011 Hey gristoi, i really appreciate ur patience and the fact that your taking the time out of your schedule to help me with this issue. But like you said, i think i was missing the point by trying to go around the fact that i needed an isp address something i don't have. so i think im just gonna purchse some hosting form go daddy and be done ps.... the internet stuff your right. Im moving out in a week so there is no point in changing my actual internet to wireless. Quote Link to comment https://forums.phpfreaks.com/topic/239508-need-help-on-verifying-email-address-project/#findComment-1231077 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.