TimeTrex to allow non-standard email domain names.

Use this forum to discuss desired new features for TimeTrex
Locked
Nox
Posts: 65
Joined: Tue Nov 04, 2008 1:20 pm

TimeTrex to allow non-standard email domain names.

Post by Nox »

We have a policy in our company where our call center agents must have email, but it is not a publicly available email address. As a result, we have an @domain.local email suffix for those users so all of our corporate users can still communicate internally with one another.

However, timetrex will not let me add @domain.local as a valid email address. I'm guessing the software is looking for a .COM, .NET etc. I can certainly understand if this is a by design to help users from entering invalid email addresses, but I'd love to see a server-side preference to turn off email domain checking.

Perhaps there is a file I can edit and add .LOCAL to the domains it checks?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: TimeTrex to allow non-standard email domain names.

Post by shaunw »

You can modify classes/modules/core/Validator.class.php, around line 350 you will see:

Code: Select all

	function isEmail($label, $value, $msg = NULL) {
		//Debug::text('Raw Email: '. $value, __FILE__, __LINE__, __METHOD__, $this->verbosity);

		if ( preg_match('/^[\w\.\-\&]+\@[\w\.\-]+\.[a-z]{2,4}$/i',$value) ) {
			return TRUE;
		}

		$this->Error($label, $msg);

		return FALSE;
	}
Change the preg_match line {2,4} to {2,5}, like this:

Code: Select all

	function isEmail($label, $value, $msg = NULL) {
		//Debug::text('Raw Email: '. $value, __FILE__, __LINE__, __METHOD__, $this->verbosity);

		if ( preg_match('/^[\w\.\-\&]+\@[\w\.\-]+\.[a-z]{2,5}$/i',$value) ) {
			return TRUE;
		}

		$this->Error($label, $msg);

		return FALSE;
	}
If you are using TimeTrex v3.0 or above you will also need to change your mail options to use a local SMTP server as well, you can do this by adding the following block to the timetrex.ini.php file:

Code: Select all

[mail]
delivery_method = smtp
smtp_host=smtp.gmail.com
smtp_port=587
smtp_username=john.doe@gmail.com
smtp_password=mypass
If you are using Linux or have a local SMTP server setup that automatically handles mail, you could try using this instead:

Code: Select all

[mail]
delivery_method = mail
Locked