How to do this? EmailMessage.ValidateAddress = false

  • Thread starter Thread starter Miguel Dias Moura
  • Start date Start date
M

Miguel Dias Moura

Hello,

when i uploaded my web site to a server i got this message everytime there
was a form with authentication of an email address:

System.Exception: The FromAddress is not syntactically correct, based upon
the pattern set by EmailMessage.ValidateRegEx: [\w-]+@([\w-]+\.)+[\w-]+ To
turn preliminary email address syntax checking, set
EmailMessage.ValidateAddress = false.

My questions are:
- Why does this happen?
- Where and how to i insert this code to solve this problem:
EmailMessage.ValidateAddress = false

Thanks,
Miguel
 
This is in your own code ? What is the class you are using ?

It looks like the regular expression doesn't allow a dot before the @ sign
(which is sometimes used and works but not allowed in theory).

Patrice
 
Found it at :
http://www.aspnetemail.com/help/aspnetemail.emailmessage.validateaddress.html
In this sample they are adding the line just after the object is created.

You could also use another RegExp to take this into account (if you have
something that doesn't match before the @)

Patrice

--

Patrice said:
This is in your own code ? What is the class you are using ?

It looks like the regular expression doesn't allow a dot before the @ sign
(which is sometimes used and works but not allowed in theory).

Patrice

--

Miguel Dias Moura said:
Hello,

when i uploaded my web site to a server i got this message everytime there
was a form with authentication of an email address:

System.Exception: The FromAddress is not syntactically correct, based upon
the pattern set by EmailMessage.ValidateRegEx: [\w-]+@([\w-]+\.)+[\w-]+ To
turn preliminary email address syntax checking, set
EmailMessage.ValidateAddress = false.

My questions are:
- Why does this happen?
- Where and how to i insert this code to solve this problem:
EmailMessage.ValidateAddress = false

Thanks,
Miguel
 
I have something like this:

<td>Write your email: >
<asp:RequiredFieldValidator ID="emailRequired" ControlToValidate="from"
ErrorMessage="?" Display="Dynamic" runat="server" CssClass="redNoteTitle"
ToolTip="Write your
email"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
ID="emailRegular" ControlToValidate="from" ErrorMessage="?"
Display="Dynamic" runat="server" ToolTip="Invalid Email"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
CssClass="redNoteTitle"></asp:RegularExpressionValidator>
</td>

The part of the form is:

<td><asp:TextBox Columns="31" CssClass="greyNoteText" ID="from"
runat="server" ToolTip="Write your email" /></td>

This is very strange because in the same web site i have other forms with
email validation.
But in this one i get this error. Even more strange is that the problem only
happens with the email validation not with the required field.

I did that you said but that's not the problem.

Do you see anything wrong here?

Thanks,
Miguel


Patrice said:
Found it at :
http://www.aspnetemail.com/help/aspnetemail.emailmessage.validateaddress.htm
l
In this sample they are adding the line just after the object is created.

You could also use another RegExp to take this into account (if you have
something that doesn't match before the @)

Patrice

--

Patrice said:
This is in your own code ? What is the class you are using ?

It looks like the regular expression doesn't allow a dot before the @ sign
(which is sometimes used and works but not allowed in theory).

Patrice
[\w-]+@([\w-]+\.)+[\w-]+
 
But the email i inserted has no dot before the @.

Patrice said:
This is in your own code ? What is the class you are using ?

It looks like the regular expression doesn't allow a dot before the @ sign
(which is sometimes used and works but not allowed in theory).

Patrice

--

Miguel Dias Moura said:
Hello,

when i uploaded my web site to a server i got this message everytime there
was a form with authentication of an email address:

System.Exception: The FromAddress is not syntactically correct, based upon
the pattern set by EmailMessage.ValidateRegEx: [\w-]+@([\w-]+\.)+[\w-]+ To
turn preliminary email address syntax checking, set
EmailMessage.ValidateAddress = false.

My questions are:
- Why does this happen?
- Where and how to i insert this code to solve this problem:
EmailMessage.ValidateAddress = false

Thanks,
Miguel
 
Back
Top