ThomasBalaban Posted June 21, 2013 Share Posted June 21, 2013 <section id="content"> <article> <div id="leftForm"> <h5>Login <span class="small">(case sensitive)</span></h5> <form action="processes/processLogin.php" method="post"> <span class="break"><label for="userName">Username:</label><input type="text" name="userName" ></span> <span class="break"><label for="userPass">Password:</label><input type="password" name="userPass" ></span> <span class="break"><input type="submit" value="login"></span> </form> </div> <!-- start PHP code --> <?php if(isset($_POST['createUser']) && !empty($_POST['createUser']) AND isset($_POST['email']) && !empty($_POST['email'])){ $createUser = mysql_escape_string($_POST['createUser']); // Turn our post into a local variable $email = mysql_escape_string($_POST['email']); // Turn our post into a local variable $result4 = run_my_query3("select * from users WHERE userName = '$createUser' limit 1"); while($row = mysql_fetch_array($result4)){ $userId = $row["userId"]; $userName = $row["userName"]; } $result = run_my_query("select * from users WHERE userName = '$createUser' "); if($row = mysql_fetch_array($result)){ $badUser = true; } else { $badUser = false; } if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ // Return Error - Invalid Email $msg = 'The email you have entered is invalid, please try again.'; }else if($badUser == true){ $msg = 'Username already in use'; }else{ // Return Success - Valid Email $msg = 'Your account has been made, <br /> please verify it by clicking the activation link that has been send to your email.'; $hash = md5( rand(0,1000) ); // Generate random 32 character hash and assign it to a local variable. // Example output: f4552671f8909587cf485ea990207f3b $createPassword = rand(1000,5000); // Generate random number between 1000 and 5000 and assign it to a local variable. // Example output: 4568 run_my_query3(" INSERT INTO users VALUES (null, '".mysql_escape_string($createUser)."', '".mysql_escape_string($createPassword)."', 'user', null, 'Fill this out~', null, null, '". mysql_escape_string($email) ."', 0, '". mysql_escape_string($hash) ."') "); /*VERIFICATION EMAIL */ $to = $email; // Send email to our user $subject = 'Afterlyfe Gaming | Verification'; // Give the email a subject $message = ' Thanks for signing up! Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. ------------------------ Username: '.$createUser.' Password: '.$createPassword.' ------------------------ Please click this link to activate your account: http://thomasbalaban.com/pieces/afterlyfeGaming/verification.php?email='.$email.'&hash='.$hash.' '; // Our message above including the link $headers = 'From:noreply@thomasbalaban.com' . "\r\n"; // Set from headers mail($to, $subject, $message, $headers); // Send our email } } ?> <!-- stop PHP Code --> <div id="rightForm"> <h5>Not Registered? Register here!</h5> <form action="" method="post" > <span class="break"><label for="createUser">Your username: <span id="userError"></span></label><input type="text" name="createUser" id="createUser" value=""></span> <span class="break"><label for="email">Email:</label><input type="text" name="email" value=""></span> <br /> <span class="break"><input type="submit" value="Sign up" /></span> </form> <?php if(isset($msg)){ // Check if $msg is not empty echo '<div class="statusmsg">'.$msg.'</div>'; // Display our message and wrap it with a div with the class "statusmsg". } ?> </div> </article> </section> That is the relevant code. The issue I get is when I attempt to do a email the following error appears Warning: mail() [function.mail]: SMTP server response: 530 SMTP authentication is required. inC:\HostingSpaces\afterlyf\thomasbalaban.com\wwwroot\pieces\afterlyfeGaming\login.php on line 134 How would I fix my code up to fix this error? I am new to the mail function so I apologize if my question is really basic. Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted June 21, 2013 Share Posted June 21, 2013 Good afternoon Thomas, I don't know much about this but I found this which might be of use to you: http://stackoverflow.com/questions/11394099/how-to-fix-warning-mail-function-mail-smtp-server-response-530-smtp-authe Kind regards, L2c. Quote Link to comment 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.