1

Topic: Allowing registration only from a specefic domain

Hi,
I need help to modify the register.php file to check domain name of the email user is inputting,
I want to allows visitors that has email adress @gmail.com can register.
i looked at register.php, at the validation part, it requires include/mail.php,
I think this line should be modified to do the job i want,

return preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);

but i don't know what to write instead.
Any helps pleas!
Regards

2

Re: Allowing registration only from a specefic domain

I don't understand exactly what you says. At least I don't see any code in register.php blocking Gmail addresses.
Gmail users are normally registered, at least in my forum.

What I have is several users of Yahoo and Hotmail, who cannot receive e-mails, both from registration process or  from the forgotten passwords.

I have check these messages truly are leaving from the server. Therefore there is something in the email headers that Yahoo and Hotmail don't like and probably they are blocked like spam. 

Specially, the e-mail headers lacks of a Reply to: field, and also they contain a
Received: from nobody by host.mydomain.com with local ....

maybe the sum of these two causes that blocking. I'm looking how replacing this issue.


Somebody know about that?

3 (edited by svo 2007-04-04 02:33)

Re: Allowing registration only from a specefic domain

yes, it is the cause. There is not Reply-to in the headers, and they are blocked. I have check it now with one Yahoo account.

To solve this, go to include/email.php:

line 78:

delete this line:

$headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'X-Mailer: PunBB Mailer';

and replace with this:

        $replyto = $pun_config['o_webmaster_email'];

    if ($from != $pun_config['o_webmaster_email']) {
        $replyto = $from;
    } 
            
    $headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'Reply-To: '.$replyto."\r\n".'X-Mailer: PunBB Mailer';

note the first line makes that all automatic messages they now have an automatic reply to your webmaster address. If you don't want replies in your main email address, then the best thing is creating a new e-mail account in your server, in example rubbish@mydomain.com. In this way,  those e-mails will be received in that account which must be cleaned periodically. In this case,  you will need to replace the first line of this patch with your new e-mail address for the unwanted replies:

    $replyto = 'rubbish@mydomain.com';

that's all. Rest of messages between users inside the forum will work normally.

--