What are the drawbacks of generating passwords in plaintext, sending them via email, and then encrypting them in PHP scripts?

Storing passwords in plaintext, sending them via email, and then encrypting them in PHP scripts poses a significant security risk. This method exposes passwords to potential interception during email transmission and leaves them vulnerable in plaintext form before encryption. To address this issue, passwords should be hashed securely before storage and transmission, rather than being sent in plaintext.

// Hashing the password before storing it
$password = "user_password";
$hashed_password = password_hash($password, PASSWORD_DEFAULT);

// Sending the hashed password via email
$email_body = "Your password: " . $hashed_password;
// Code to send email...

// Verifying the password
$entered_password = "user_entered_password";
if (password_verify($entered_password, $hashed_password)) {
    echo "Password is correct!";
} else {
    echo "Password is incorrect!";
}