Reputation: 19356
I know how to send an email with C#. To do that, I need to know the user and password of the user.
I have a base knowledge about how to store the password using a hash + salt, to store the hash of the password, so each time that the application get the password, do the hash and compare with the value of the generated hash. This is good for login, because the user type the password to can use the application.
However, for send an email, I would like to avoid that the user has to write the password of the email, so the solution for the login doesn't works for this case. I would like to store the password in the database in someway and the aplication can get it. The problem is that if I store the hashed password, the aplication can't get the password because the hash in one way encryption.
So I would like to know what alternatives I could use to store the password in a secure way in the database and the application can get it to send the emails.
Thanks.
Upvotes: 1
Views: 546
Reputation: 132
Ideally, emails are sent using a default or common email Ids by services. But, in your case if service is being used by many users for sending emails, you should ask user(first time) to logging into it and then you can generate a session(for a specified time period) and based on this you should send emails. Once a session key is expired, user should be forced to re-logging. So, a session is generated for each user, after successful logging, who are to use this service for emails.
So, this would not require to save password anywhere, as saving a password in it's original form or any other form that can be retrieved-back is not advisable.
Upvotes: 1