As it is, the code so far doesn't even come close to properly validating an email address.The problem is so complex, actually, that the complete, industry-standard, regex for it is actually broken.But what if I told you there were a way to determine whether or not an email is valid without resorting to regular expressions at all? The activation email is a practice that’s been in use for years, but it’s often paired with complex validations that the email is formatted correctly.It’s surprisingly easy, and you’re probably already doing it anyway. If you’re going to send an activation email to users, why bother using a gigantic regular expression?
If this is for business, you will have to consider what exactly you are trying to accomplish.
If the user is going to be entering an e-mail address in, it should be his or her responsibility to ensure that it was entered in correctly ( You can try one of these free email validation techniques - to track bounced emails, you can build a console app using an open source POP3 library like Indy.
Sockets to download messages - You can then parse the messages to look for bounced emails using a free Mime parsing library like C# Mime Parser, Mime Kit or Sharp Mime Tools - Kit - that some of the components mentioned above haven't been updated in a while, so you'll have to try them out to verify if they work well.
Technically, you could also test the target server to see if it accepts that email address, but many servers do not respond to those requests, and if they do they may respond incorrectly.
Ah, then stick to using std::string, like you did originally and avoid c-strings.