Validate Multiple E-mail ids

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jyaseen
    New Member
    • Feb 2010
    • 21

    Validate Multiple E-mail ids

    if i insert multiple e-mail id in To textbox like below , how can i validate the email ids.
    <user1@example. com>, <user1@example. com>, "User 3" <user3@example. com>, "User 4" <user4@example. com>,

    in google if we insert ids like above or comma separated , it will accept . anybody know the coding to validate this in PHP
    Last edited by Atli; Feb 16 '10, 03:50 PM. Reason: Replaced real email addresses with example values.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    Have you tried this yourself?
    What did you try? Why/how didn't it work?

    We are happy to help you develop your code, but we won't do it for you.

    However, you are probably going to want to use a regular expression to do this. There are plenty of email-validation scripts available via Google. You would just have to adapt them to validate multiple addresses.

    Comment

    • jyaseen
      New Member
      • Feb 2010
      • 21

      #3
      Yes I try this like below , my input E-mail id is

      Code:
      $email =  '"USER1" <user1@example.com>,"USER2" <user2@example.com>,
       "User 3" <user3@example.com>, "User 4" <user4@example.com>, ";
      	
      	
      	$find = array('"Yunus Mecheri"','"unaise hameed"');
      
      	
      	$arr = str_replace($find," ",$email,$i);
      	$arr = str_replace(">"," ",$email,$i);
      	$arr = str_replace("<"," ",$arr,$i);
      	
      	$final_email_ids = str_replace($find," ",$arr,$i);
      if i enter array() manually , ie: $find . it will work , and it will give the output like
      below :
      user1@example.c om,user2@exampl e....@exa mple.com,
      use51@example.c om,user4@exampl e.com,
      but if i use array to find the value automatically ie:instead of $find if i use like below ,
      Code:
      ARRAY(  0 =>"USER1"
              1 =>"USER2"
      	2 =>"USER3"
      	3 =>"USER3"
      	4 =>"USER4"
      )
      it will not work .
      Last edited by Atli; Mar 4 '10, 11:05 AM. Reason: Added [code] tags.

      Comment

      Working...