Jump to content

forgot password email works but registeration doesnt


Lisa23

Recommended Posts

i have a form if user forgot password it send the new password to the user email but now i'm trying to is to also send when user register but is not wrking

 

this is the forgot password which works perfectlty

 

header("Location: ".$session->referrer);
  
  {
         /* Generate new password */
         $newpass = $session->generateRandStr(;
         
         /* Get email of user */
         $usrinf = $database->getUserInfo($subuser);
         $email  = $usrinf['email'];
         
         /* Attempt to send the email with new password */
         if($mailer->sendNewPass($subuser,$email,$newpass)){
            /* Email sent, update database */
            $database->updateUserField($subuser, "password", md5($newpass));
            $_SESSION['forgotpass'] = true;
         }

 

 function sendNewPass($user, $email, $pass){
      $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
  $subject = "Elite ticket master - Your new password";
  $body = $user.",\n\n"
             ."We've generated a new password for you at your "
             ."request, you can use this new password with your "
             ."username to log in to Eliteticketsevents Site.\n\n"
             ."Username: ".$user."\n"
             ."New Password: ".$pass."\n\n"
             ."It is recommended that you change your password "
             ."to something that is easier to remember, which "
             ."can be done by going to the My Account page "
             ."after signing in.\n\n"
             ."- EliteTickets's Site";


		  $server = "smtp.virgin.net";
ini_set("SMTP",$server);


             
      return mail($email,$subject,$body,$from);

 

but now i tried to do the same to register but doesnt send the email

 

 if($retval == 0){
         $_SESSION['reguname'] = $_POST['user'];
     $_SESSION['regsuccess'] = true;
         header("Location: ".$session->referrer);

	 if($mailer->sendWelcome($user, $email, $pass)){

	 }

 

 

 function sendWelcome($user, $email, $pass){
      $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
      $subject = "Elite ticket master - Welcome!";
      $body = $user.",\n\n"
             ."Welcome! You've just registered at EliteTickets Site "
             ."with the following information:\n\n"
             ."Username: ".$user."\n"
             ."Password: ".$pass."\n\n"
             ."If you ever lose or forget your password, a new "
             ."password will be generated for you and sent to this "
             ."email address, if you would like to change your "
             ."email address you can do so by going to the "
             ."My Account page after signing in.\n\n"
             ."- EliteTickets's Site";




      return mail($email,$subject,$body,$from);
   }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.