Activation Mail resend
aryansg opened this issue · 2 comments
aryansg commented
What if user didn't receive activation email, it doesn't have option to resend it. If it doesn't have it, than user can't login nor use same email for registration. So must be a way to resend activaction E-mail to registered account.
dcblogdev commented
this isn't a project but the source files for a tutorial.
To send the email again you should query the database for the user data then use the active column to send the email similar to:
$stmt = $db->prepare('SELECT id, active FROM members WHERE email = :email');
$stmt->execute(array(':email' => 'some@domain.com'));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
//send email
$to = 'some@domain.com';
$subject = "Registration Confirmation";
$body = "<p>Thank you for registering at demo site.</p>
<p>To activate your account, please click on this link: <a href='".DIR."activate.php?x=".$row['id']."&y=".$row['active'].">".DIR."activate.php?x=".$row['id']."&y=".$row['active']."</a></p>
<p>Regards Site Admin</p>";
$mail = new Mail();
$mail->setFrom(SITEEMAIL);
$mail->addAddress($to);
$mail->subject($subject);
$mail->body($body);
$mail->send();