I don't understand why you are sending them the passwords ?
The clients set their preferred password, you hash it, store the hash, and no one except the client/his password manager program knows the original password (not even you), and when they forget it, you send them a reset link.
However if you really have to send him the password, I suggest you send him a link to dynamically generated webpage that displays his password (for 1 time only).
you need to temporarily store something like this in your database
emailTocken char(32)
password varchar
+----------------------------------+------------------+
| emailTocken | password |
+----------------------------------+------------------+
| 202CB962AC59075B964B07152D234B70 | jhds7ytht_id |
| CF297E613A7F7892A3BF348EE526ABAD | hdhdbdue874# |
| 8F14E45FCEEA167A5A36DEDD4BEA2543 | yeheb8cvddt5) |
| 2510C39011C5BE704182423E3A695E91 | 6#hdyd98_jee |
| 8F14E45FCEEA167A5A36DEDD4BEA2543 | yhrtxbxv48_e |
+----------------------------------+------------------+
and send to him an email that you expose only the emailTocken not the password
Hello, client
Follow this link to see your password
https://example.com/showPassword?emailTocken=8F14E45FCEEA167A5A36DEDD4BEA2543
on the webserver when someone requests this link you do the following
- select the password that has the emailTocken provided
- delete it's record from the database
Now the first one who requests this link will see something like
Hello, client
your password is yeheb8cvddt5)
NOTE: WE WILL DELETE THIS PASSWORD FROM OUR SERVERS, SO YOU HAVE TO REMEMBER/SAVE IT
If anyone later requests the same link he will see something like
Sorry, this password is not exist or has been viewed before!
Advantages of this approach over sending the password in email:
- the password is exposed only 1 time for the first viewer, not for whoever see the email later.
- if someone else viewed the password firstly (a man-in-the-middle), the legitimate user will not be able to see it and will ask for help, which will make us know that there is something wrong happened, better than someone else see it, and we don't even know. I hope your email agent program doesn't request this automatically for any reason :( .
disadvantages of this approach over sending the password in email:
- requires web server
- more work than just sending the poassword in email easily
As I told you before, no one except the client should know the password, and I never tried this approach, but at least its better than exposing the password in plain text in an EMAIL that can reside on many computers/servers for a while.