• 0

Safest way to save emails in database


Question

Hello...

I was thinking about a good and easy way to store emails in databases.

For example, i created a small site with a contact us form and i am saving the provided email addresses in a separate field in the contact_us table.

The database is MySQL.

and it is hosted online with a paid hosting service.

do you think it is safe to save the email address as is. or should it be better to remove the @ character and replace it with another character?

10x in advance

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Should be fine, the main security concern to your application is probably SQL injection vulnerabilities.

As long as you validate the email format (there should be functions or a regex online to help with this) and use a prepared query or at least an escaping function there shouldn't be much to worry about.

Changing the @ symbol to something else won't really make any difference, I assume you a using a varchar MySQL column type or something similar.

The only other thing you have to worry about is the security of the data while its stored.

If the email addresses are valuable you have to consider general database and application security.

Link to comment
Share on other sites

This topic is now closed to further replies.