Bug?: ERROR 1.Email address is invalid.

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

  1. edge

    edge Active Member Moderator

    Today I wanted to add some new e-mail addresses to one of the domains on ISPconfig3

    Some of the e-mail addresses are single letter once (like [email protected], [email protected] .... )

    Unfortunately ISPconfig3 will give an "ERROR 1.Email address is invalid." when doing so!

    Is there maybe a quick fix for this?
     
  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 New Member

    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