Click here to Skip to main content
15,880,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

i have one field name client domain name
where i storing mutiple domain name example:gmail.com,yahoo.co.in

and i have mutiple email address like :
belge.sadhana@gmail.com,belge.sadhana@yahoo.co.in

how to check the domain valid for that email ids.

my code:


C#
 if (ds.Tables[0].Rows[0]["DomainName"].ToString() != "")
                    {
                       
                        DomainAddress = ds.Tables[0].Rows[0]["DomainName"].ToString();

                        DEmailAdress = DomainAddress.Split(',');
                        
                        
                      
                            MutipleEmailID = txtBCCEmail.Text + "," + txtCCEmail.Text + "," + lblToEmailId.Text;

                            string[] spilitemailids = MutipleEmailID.Split(',');

                            foreach (string id in spilitemailids)
                            {

                                foreach (string s in DEmailAdress)
                                {
                                   address = new MailAddress(id);

                                    if (!id.Contains("@insyncanalytics.com"))
                                    {
                                        if (!address.Host.Equals(s, StringComparison.OrdinalIgnoreCase))
                                        {
                                            if (id.Contains(s))
                                            {
                                          

                                            }
                                            else
                                            {
                                                //bad domain
                                                InvalidDomainEmailAddress.Add(address);

                                            }
                                    
                                        }
                                    }
                             }

                        }

                    }

                }
            }
        }
        catch (Exception ex)
        {

        }
        finally
        {
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
 
        }
return InvalidDomainEmailAddress;


my problem is when i loop two emailids added in arraylist i got belge.sadhana@gmail.com and belge.sadhana@yahoo.co.in.
but this two domain address is exit in the database.
but domain address exit in the database then this email id should not add in arraylist

but how i can get the answer

plz help me
Posted
Updated 17-Dec-14 18:29pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900