Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:21:24+00:00 2026-06-12T13:21:24+00:00

For inviting the new user by giving their mail addresses in text field(multipe email

  • 0

For inviting the new user by giving their mail addresses in text field(multipe email addresses), i need to validate the given email addresses format and need to show the proper error message.Here i am using the space between the each email addresses.(for example useremail@gmail.com useremail2@yahoo.com)Please guide me.

1)How to validate user email addresses format?.

2)How to check if the user doesn’t use space between the two email addresses?.

3)Suggest some best way to do this.

i am using rails(2.3.X and ruby 1.8.7)

User controller

def invite_users
  if request.get?
    #render invite_users.html.erb
  elsif request.post?
    if !params[:email_ids].blank? && !params[:message].blank?
      @email_ids = params[:email_ids].split(/ |, |,/)
      @message = params[:message]
      @inviting_users = @email_ids.count
      @inviting_users.times do
        @all_emails = []
        @all_emails = @email_ids.shift
        activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join)
        UserNotifier.deliver_invite_users(@all_emails, @message,activation_code, current_company)
        end
     else
       flash[:notice] = "Please fill all the fields"
     end
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:21:25+00:00Added an answer on June 12, 2026 at 1:21 pm

    1) You could use a simple regular expression to check the value of the email field. There are many regular expressions which may work, from the most laxist to the most über-complex one. People generally tend to use something like this :

    unless email =~ /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
       puts "Your email address does not appear to be valid")
    

    This regular expression may let pass some invalid email adresses (only very very tricky ones, so basically you can consider that this regular expression is enough in 99.99% of the time). If you really want a (almost) flawless checking, you may consider this one : http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html (I don’t know if you need that much though).

    For more regular expressions to validate email adresses (and simpler than my last one of course), please take a look here : Using a regular expression to validate an email address

    2) Just strip() the field where both e-mail adresses are entered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a site for someone where they are inviting their music artists
I want to have a javascript overlay box load on startup inviting users to
I am trying to add an app request from a user using Koala/Omniauth @graph
i'm trying to check all checkboxes when inviting guests to a facebook event. Facebook
I have 4 tables... users, friends, articles & article_shares (as in written) A user
I use Selenium WebDriver with firefox. Every time selenium generates new anoniumus profile for
I'm working on a new social networking site and I want to give users
Are there particular cases where native text manipulation is more desirable than regex? In
can I have a question about how to redirect the page after user invite
I have used facebook friends app for inviting friends in my app. So I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.