php? Posted December 31, 2007 Share Posted December 31, 2007 How do i create an email account that I can use to send verifications Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/ Share on other sites More sharing options...
rajivgonsalves Posted December 31, 2007 Share Posted December 31, 2007 create an email account ? please elaborate your question is very vague Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426504 Share on other sites More sharing options...
php? Posted December 31, 2007 Author Share Posted December 31, 2007 I downloaded a login/registration script that has step by step instructions on adding stuff. AND Well... in order to send email verifications from my website.. too my members, it requires an email address. Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426507 Share on other sites More sharing options...
php? Posted December 31, 2007 Author Share Posted December 31, 2007 Srry double post Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426521 Share on other sites More sharing options...
php? Posted December 31, 2007 Author Share Posted December 31, 2007 Comes up with this error when i try to register 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\login\register.php on line 23 Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426523 Share on other sites More sharing options...
thiggins09 Posted December 31, 2007 Share Posted December 31, 2007 To use php's mail function, you don't need to actually have the email you are saying you are sending from. For example: $to = "someone@example.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; you dont need to actually have someonelse@example.com setup, it just says its from them. Look here for more: http://www.w3schools.com/php/php_mail.asp Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426524 Share on other sites More sharing options...
php? Posted December 31, 2007 Author Share Posted December 31, 2007 Oh thats cool... but how come it still has the error Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426526 Share on other sites More sharing options...
blueman378 Posted December 31, 2007 Share Posted December 31, 2007 by the looks of it it is looking for a local smtp server on your machine and you dont have one set up (either at all or correctly) can we please see the script Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426529 Share on other sites More sharing options...
php? Posted December 31, 2007 Author Share Posted December 31, 2007 <?php require_once('db.php'); include('functions.php'); if(isset($_POST['register'])) { if($_POST['username']!='' && $_POST['password']!='' && $_POST['password']==$_POST['password_confirmed'] && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && checkUnique('Username', $_POST['username'])==TRUE && checkUnique('Email', $_POST['email'])==TRUE) { $query = mysql_query("INSERT INTO users (`Username` , `Password`, `Email`, `Random_key`) VALUES ('".mysql_real_escape_string($_POST['username'])."', '".mysql_real_escape_string(md5($_POST['password']))."', '".mysql_real_escape_string($_POST['email'])."', '".random_string('alnum', 32)."')") or die(mysql_error()); $getUser = mysql_query("SELECT ID, Username, Email, Random_key FROM users WHERE Username = '".mysql_real_escape_string($_POST['username'])."'") or die(mysql_error()); if(mysql_num_rows($getUser)==1) {//there's only one MATRIX :PP $row = mysql_fetch_assoc($getUser); $headers = 'From: webmaster@ourdomainhere.com' . "\r\n" . 'Reply-To: webmaster@ourdomainhere.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = "Activation email from ourdomainhere.com"; $message = "Dear ".$row['Username'].", this is your activation link to join our website. In order to confirm your membership please click on the following link: http://www.ourdomainhere.com/confirm.php?ID=".$row['ID']."&key=".$row['Random_key']." Thank you for joining"; if(mail($row['Email'], $subject, $message, $headers)) {//we show the good guy only in one case and the bad one for the rest. $msg = 'Account created. Please login to the email you provided during registration and confirm your membership.'; } else { $error = 'I created the account but failed sending the validation email out. Please inform my boss about this cancer of mine'; } } else { $error = 'You just made possible the old guy (the impossible). Please inform my boss in order to give you the price for this.'; } } else { $error = 'There was an error in your data. Please make sure you filled in all the required data, you provided a valid email address and that the password fields match'; } } ?> <?php if(isset($error)){ echo $error;}?> <?php if(isset($msg)){ echo $msg;} else {//if we have a mesage we don't need this form again.?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> Username: <input type="text" id="username" name="username" size="32" value="<?php if(isset($_POST['username'])){echo $_POST['username'];}?>" /><br /> Password: <input type="password" id="password" name="password" size="32" value="" /><br /> Re-password: <input type="password" id="password_confirmed" name="password_confirmed" size="32" value="" /><br /> Email: <input type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /><br /> <input type="submit" name="register" value="register" /><br /> </form> <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426530 Share on other sites More sharing options...
blueman378 Posted December 31, 2007 Share Posted December 31, 2007 can i please see functions.php Quote Link to comment https://forums.phpfreaks.com/topic/83820-email/#findComment-426581 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.