This has been bugging me for a while now, we often get tickets with emails that don't have correct domains, eg hptmail.com or gmaii.com. A while back I looked at customizing the way email addresses are validated on new ticket creations, solved it today. Just replace the function is_email($email) { from class.validation.php in the includes directory with the following code.

Basically for anyone that doesn't know PHP, this function now uses a basic RegEx or regular expression match to look for a valid email address eg me@mydomain.com but then also now does an MX Record lookup to ensure that the domain exists.

function is_email($email) {$exp = "^+(+)*@(+(+))+$";if(eregi($exp,$email)){ if(checkdnsrr(array_pop(explode("@",$email)),"MX")){   return true;  }else{   return false;  }  }else{   return false; }}

Your Welcome :-)

[class.validator.php.txt](https://forum.osticket.com/assets/files/migrated/FileUpload/15/7ee4a1effb0c4bb8a3a1c5e3eaa9a8.txt)

+1You might want to consider adding this as a pull request to get included in the next version of osTicket.

Hi ntozier,

That would be great to be included in the next release, how do I go about adding a pull request? Sorry im new to the forum.

Cheers

You would do it on github.https://github.com/osTicket/osTicket-1.8

All done, not sure I have done it totally correctly however?Cheers

Write a Reply...