Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

You have a suggestion for a future version of phpMyFAQ? Then post it here!

Moderator: Thorsten

Post Reply
dbillon2
Posts: 4
Joined: Fri May 11, 2012 3:14 pm

Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by dbillon2 »

Suite à une mise à jour de phpMyFaq de la version 2.0.15 à la version 2.7.3, je tente de restreindre le domaine pour l'utilisateur qui renseigne le champ "Votre adresse e-mail ".
Dans la version 2.0.15, j'ai adapté la fonction "checkEmail" du fichier /inc/functions.php, mais je ne parviens pas à la même chose dans la version 2.7.3.

Merci d'avance pour l'aide.
Bye, Dylan
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by Thorsten »

HI,

it's now in inc/Mail.php and the method is called validateEmail()

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
dbillon2
Posts: 4
Joined: Fri May 11, 2012 3:14 pm

Re: Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by dbillon2 »

Hi,

First of all, thank you for the reply.
I tried to restrict the mail address in the method called "validateEmail" but something is wrong.

Here is a part of the functions.php file from phpMyFaq 2.0.15 :

function checkEmail($sender)
{
global $IDN;
$sender = $IDN->decode($sender);

$senderDomain = substr($sender, -10, 10);

$pattern = "#^[-!\#$%&\"*+\\./\d=?A-Z^_|'a-z{|}~]+".
"@".
"[-!\#$%&\"*+\\./\d=?A-Z^_|'a-z{|}~]+\.".
"[-!\#$%&\"*+\\./\d=?A-Z^_|'a-z{|}~]+$#";
if ($senderDomain == '@gmail.com') {
if (preg_match($pattern, $sender)) {
return true;
} else {
return false;
}
} else {
return false;
}
}

Could you help me to do the same in the Mail.php file, please ?
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by Thorsten »

Hi,

what are you trying to do?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
dbillon2
Posts: 4
Joined: Fri May 11, 2012 3:14 pm

Re: Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by dbillon2 »

Hi,

I'm trying to force users in the FAQ to give email address from "gmail.com" domain.

Dylan
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by Thorsten »

HI,

so only @gmail.com addresses should be valid?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
dbillon2
Posts: 4
Joined: Fri May 11, 2012 3:14 pm

Re: Function checkEmail - phpmyfaq-2.0.15 VS phpmyfaq-2.7.3

Post by dbillon2 »

Hi,

Yes. The FAQ is only for few people.

Dylan
Post Reply