Bug?: ERROR 1.Email address is invalid.

Discussion in 'General' started by edge, Jul 13, 2009.

  1. edge

    edge Active Member Moderator

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can change the regular expression in the form definition file of the mail_user form.
     
  3. edge

    edge Active Member Moderator

    Where can I find this mail_user form¿
     
  4. vogelor

    vogelor ISPConfig Developer ISPConfig Developer

    debian:

    /usr/local/ispconfig/interface/web/mail/form
     
  5. edge

    edge Active Member Moderator

    I've had a look at the files in /usr/local/ispconfig/interface/web/mail/form, but I can not find the regular expression that is handeling this.

    Any more clues?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Sorry, the email regex is defined in the global form handling file /usr/local/ispconfig/interface/lib/classes/tform.inc.php

    Around line 643 you will find the regular expression for the email address validation:

    if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
     
  7. edge

    edge Active Member Moderator

    I found it, but unfortinatly it did not work for me. I guess I'm doing something wrong.
    I've changed the {2,10} part in
    PHP:
    if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i"$field_value)) { 
    to: {1,10}
    PHP:
    if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{1,10}$/i"$field_value)) { 
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    What you changed is the length of the domain suffix. e.g. you would be able to add now things like [email protected] instead if domain.com. Try this instead:

    if(!preg_match("/^\w+[\w.-]*@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
     

Share This Page