daveh / php-account-activation

Source code to accompany the video on PHP account activation
https://youtu.be/kC0AIip7Bww
MIT License
6 stars 2 forks source link

The account acctivation mail send full code without any funcion #1

Open SWEz11 opened 8 months ago

SWEz11 commented 8 months ago

Hello, when I signup and the system send the email to me that email looks like this: image But I need the word "here" be a button. Thanks!

SWEz11 commented 8 months ago

The code:

if ($stmt->execute()) {

    $mail = require __DIR__ . "/mailer.php";

    $mail->setFrom("noreply@example.com");
    $mail->addAddress($_POST["email"]);
    $mail->Subject = "Account Activation";
    $mail->Body = <<<END

    Click <a href="http://example.com/activate-account.php?token=$activation_token">here</a> 
    to activate your account.

END;
daveh commented 8 months ago

It looks like you need to set the emailer format to HTML:

$mail->isHTML(true);

SWEz11 commented 8 months ago

Hello daveh, thank you for response! It work! But how I can make that when person verify account activation, the system send email like: Thank you, (username) for sign up in my website

-Thanks

daveh commented 8 months ago

In the script that activates the account, use the same technique using PHPMailer

SWEz11 commented 8 months ago

Thank you for response! Last question, how can I edit this line: image Because, when a person request for forgot password the sql set set reset_token_expires_at: 2024-02-15 10:20:33, but my time zone is UTC +2 ( Now in my country at this moment I write this message is 11:57).

-Thank you!

daveh commented 8 months ago

You can set your timezone in [php.ini: https://stackoverflow.com/questions/32224547/setting-the-timezone-for-php-in-the-php-ini-file](php.ini: https://stackoverflow.com/questions/32224547/setting-the-timezone-for-php-in-the-php-ini-file)

SWEz11 commented 8 months ago

Thank you daveh for help!

2024-02-16, pn 08:00, Dave Hollingworth @.***> rašė:

You can set your timezone in [php.ini: https://stackoverflow.com/questions/32224547/setting-the-timezone-for-php-in-the-php-ini-file](php.ini:

https://stackoverflow.com/questions/32224547/setting-the-timezone-for-php-in-the-php-ini-file )

— Reply to this email directly, view it on GitHub https://github.com/daveh/php-account-activation/issues/1#issuecomment-1947805976, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAVNWAG6HV4DWGKA4DB7LJ3YT3YZBAVCNFSM6AAAAABDH3EH5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXHAYDKOJXGY . You are receiving this because you authored the thread.Message ID: @.***>