.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

EMail Validation Problem

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hai friends,         I have to do  validation for E-Mail using JAVA Script,  The Following code was not working, function Valid() { if (ValidateEmail("<%= textBox.ClientID %>") ) { alert ("Correct"); return true ; } else { alert ("Not Correct"); } } function ValidateEmail(email) { var EmaiAddress=document.getElementById(email); var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; if(!RegExEmail .test (EmaiAddress )) { return false ; } else { return true ; } } <asp:button id="button" runat="server" OnClientClieck="validateEmail() " >but,This code was working, function ValidateEmail() { var EmaiAddress=document.getElementById("textbox").value; var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; if(!RegExEmail .test (EmaiAddress )) { alert("Not Correct"); } else { alert("Not Correct"); } } <asp:button id="button" runat="server" OnClientClieck="validateEmail() " >   Please Fix the solution.  

View Complete Post

More Related Resource Links

Sharepoint 2007 Email problem


I've used Sharepoint 2007 to create my website. Within my web pages I've included Forms in order to capture people's contact details, so that when they 'Submit' the form their details are emailed to my email account. The problem is that when I go to Form Properties and insert the email address to which I want the data sent, I receive this message: "This form cannot be configured to send results via email. The web site may be based at a disk-based location, or a location that has not been configured to send email. Contact your system admin or ISP for more info. Would you like to remove the email recipient Yes or No"   

I am satisfied that the settings within the webhosting service are correct. Is this functionality available with Sharepoint 2007 or do I need to switch to alternative software.



validation problem

hii design a register users form for my wesite.i using validation controls in my form, for instance(requiredfield validator and compare validator)i make validation group for my validation controls and register buttonvalidation group is equal for all my validation controls and button. when is empty one of textboxes and i click on register button first run button function then enable validationsthis is my problemthe validations must enable before run the button functionthis is my html codes:<table class="format">                                <tr>                                    <td colspan="2">                                        <asp:Label ID="Label10" runat="server" Font-Bold="True" Font-Names="Tahoma"             &n

email subscription problem

Hello All Experts, I have created email subscription for one report, which is working properly. I have scheduled it on everyday,its automatically send emails to the concern email id on everyday basis. Now is there any way suppose when reports get executed and reports comes blank then its shouldnt send mail on that day. Is it possible or not? Because currently the report is coming blank then also its sending blank report to the concern email id. Please guide me. Regards,AKM  

Date validation problem modelstate.isvalid is false

In my view i am formatting the date as follows<%= Html.TextBox("MemoDate", string.Format("{0:dd/MM/yyyy hh:mm}", DateTime.Now),new{ @readonly = true })%> In controller ModelState.IsValid become false as my current culture culture {en-US} doesn't match with the format of date.

Regular Expression, Email Validation, Consective dots name part

Hi All Can you please help me to modify this regex to validate consecutive dots in the name part (before @) of the email string.  For example, i want to disqualify an email string like (george...antony@gmail.com).  But an email string with single dots in the name part should be allowed (george.antony@gmail.com).   This regex is validating the consecutive dots after the @ sign (domain part) .    All other validation with this regex is as expected.   ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$     Thanks in advance george

SSIS 2005 - Send Mail Task - signature appended to email is garbled - unicode problem?

Hi, I'm pretty new to SSIS so go easy on me. I have a Send Mail Task to notify if a file cannot be imported - the mailbody is created on the previous step by a VB.NET script task to include the name of the file and the path it's been archived to. The problem I'm having is that while the body of the email I've created is displaying fine, our company's Exchange server appends a signature to all emails, and this is coming up as undisplayable characters, presumably due to some kind of unicode encoding problem. I've tried casting the email body in an expression to DT_STR (doesn't work as DT_STR "cannot be converted to a supported type" which seems a bit odd but never mind), DT_WSTR (garbled signature), DT_TEXT/DT_NTEXT (strange error on this one - "Attempted to read or write protected memory") none of those ideas worked, and I'm a bit stumped now. Can anyone help? I'm using SSIS 2005 with SP3

SSRS 2008 R2 Problem understanding View State Validation steps

Hi, Sorry, but I have some problem understanding this steps. Please help me to understand this.  Pasted from http://technet.microsoft.com/en-us/library/cc281307.aspx?lc=1033 How to Configure View State Validation To run a scale-out deployment on an NLB cluster, you must configure view state validation so that users can view interactive HTML reports. You must do this for the report server and for Report Manager. View state validation is controlled by the ASP.NET. By default, view state validation is enabled and uses the identity of the Web service to perform the validation. However, in an NLB cluster scenario, there are multiple service instances and web service identities that run on different computers. Because the service identity varies for each node, you cannot rely on a single process identity to perform the validation. To work around this issue, you can generate an arbitrary validation key to support view state validation, and then manually configure each report server node to use the same key. You can use any randomly generated hexadecimal sequence. The validation algorithm (such as SHA1) determines how long the hexadecimal sequence must be. Generate a validation key and decryption key by using the autogenerate functionality provided by the .NET Framework. (Well, how to generate Validation key using .Net Framework?) In the end, you must have a singl

validation problem

hii design a user register form for my website.in this form i using validation control.for instance : required field validator and compare validator.but i have problem with this controlsi make a Validationgroup for validation with register button.validationgroup is equal for all controls(validations and button).when i dont fill textboxes and i click on the button first run the button function then run validations.where is my problem?this is my html codes:<table class="format">                                <tr>                                    <td colspan="2">                                        <asp:Label ID="Label10" runat="server" Font-Bold="True" Font-Names="Tahoma"                   &

Email - From Address Problem

Hello All,I have a sample Email code - MailMessage Message = new MailMessage(); Message.IsBodyHtml = true; Message.To.Add(new MailAddress("TO@gmail.com","ToName")); Message.From = new MailAddress("FROM@abc.com","FromName"); Message.Subject = "Test Sub"; Message.Body = "This is Test!!!"; SmtpClient sc = new SmtpClient(); sc.UseDefaultCredentials = false; sc.Host = "smtp.gmail.com"; sc.Port = 587; sc.Credentials = new NetworkCredential("CREDENTIALS@gmail.com", "CredentialsPassword"); sc.EnableSsl = true; sc.Send(Message); When i Use this code - Email is going 100% successfully but, Insted of displaying from address as "FROM@abc.com" - it is displaying it as "CREDENTIALS@gmail.com".** From Name is displaying correctly.So the email in email Client is pretty confusing with this problem. Kindly suggest me some work arounds.FROM@abc.com

Email Problem with Exchange 2010

Good day,   I recently upgraded a server of mine with a simple ASP site to server 2008 and it sent emails from exchange 2003 with no problems after the upgrade to server 2008.  Here is the code: private void SendTextMessageCC(string fromAddress, string fromName, string toAddress, string subject, string body, string ccAddress) { try { MailAddress fromAdd = new MailAddress(fromAddress, fromName); MailAddress toAdd = new MailAddress(toAddress); MailAddress ccAdd = new MailAddress(ccAddress); MailMessage msg = new MailMessage(fromAdd, toAdd); msg.Subject = subject; msg.Body = body; msg.CC.Add(ccAdd); SmtpClient client = new SmtpClient("deexch1.****.com"); // localhost client.Send(msg); // msg.DeliveryNotificationOptions = 0; // 2 means OnFailure was 1 but that was error 0 okay means "None" } catch (SmtpException s) { lblSuccess.Text = s.Message; } } Now this week I upgraded my Exchange Server to 2010 and changed the smtpclient string accordingly above to SmtpClient("draw-mail1.****.com"). It will not send emails from the se

Email Attachment Problem

hi everyone,I am having a chart, and want to be able to click the "send it by email" and then popup an email window with the chart on the attachment.However, the attachment does not show.here is my code: string ServerPath = Protocol + Request.ServerVariables["SERVER_NAME"] + Port + Request.ApplicationPath + @"/graphs/" + User.Identity.Name + graphID + ".jpg"; string mailToString = "mailto:?subject=Trade Graph&Body=See attachment for the charts, or please click: " + ServerPath + "&Attachment="+ServerPath; string popupScript = "<script language='javascript'>" + "window.open('" + mailToString + "', 'CustomPopUp', " + "'width=200, height=200, menubar=yes, resizable=no')" + "</script>"; Page.ClientScript.RegisterStartupScript(typeof(Page), "PopupScript", popupScript); thank you guys!

Problem sending an email to all users of a sharepoint group

Here is what we did so far: 1. created an OU in AD and delegated full control to Sp service account 2. Configured incoming email settings 3. on sp site created a new group with full control permission 4. created an email distribution group for this group with an email address 5. in CA approved the distribution group to be created in OU 6. In Ad we can check the OU is there with the specified email address 7. added users to the group, but when we send an email to the group email address it does not forward to the group members. Please advice  

regarding validation of user information problem


Iam new to asp.net. in my web page iam validating user information such as fname,lname,sex,add and also login (to register to website)information emailid and password . here iwant to check email adrress (availblity) and tht iam doing it fine. but when iam validating all the textbox,which are there before emailid  something like this




login details

emailid:   check (buttonto check email availiblity)


retype password:


iam using validation controls for all the text boxes , when iam using my tab to enter the values it w,l give me alll error messege until i fill it. and when i reach email textbox  and check availblity then i cant check untill i fill the password and retype password texboxes..i can only check the email availblity only when al the fields are valid . but i want to valid the emailid before i could enter password and retype password ? how to do this  pls help me out..

Problem with date validation.


I have the following code:

protected bool ValidGebdat()
    Regex LongDate = new Regex("^([1-9]|0[1-9]|1[012])[- /.]([1-9]|0[1-9]|[12][0-                   9]|3[01])[- /.][0-9]{4}$");

    string gebDat = GebdatTB.Text;

    string s = gebDat.Trim();

            if (LongDate.Match(s).Success)
                   return true;
                  return false;

Why do I get a return false when I insert "27-02-1970"?

Validation expression problem


Ok, im in the process of updating our member registration form. We have always used this reg. exp. for emails and it works OK:


But I wanted to update it and found this one posted on some forums and on some major sites:


Like this:

<asp:RegularExpressionValidator ID="valEmailCorrect" ForeColor="" runat="server" Display="Dynamic" ControlToValidate="tbemail"  ValidationExpression="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$"></asp:RegularExpressionValidator>

This expression doesent work at all for me, cant enter any mail at all, all mails are rejected?!  Does anyone knows why?

Email validation


Hi , i was wondering what was the simplest way to validate a form field. i come from php , i know regexp but i see there is a validation class.

How can i use it ?

btw , webmatrix rocks for simple professional projects.

sending email problem


hi everybody,
i have serious problem in my web site.
i had use some sort of code to send email in my website.the problem is that code works properly in one page and don't work on the other page.
i'm completely confused.
the code behind and web.config :

MailMessage mail = new MailMessage();
mail.From = new MailAddress("contacts@website.com");
mail.Subject = txtSubject.Text;
mail.Body = "
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("mailserver.com");
smtp.Credentials = new NetworkCredential("contacts@website.com","password");

W E B . C O N F I G

<network defaultCredentials="false"/>

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend