|
This checks the Email id Format
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
return "Invalid E-mail ID"
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
return "Invalid E-mail ID"
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
return "Invalid E-mail ID"
}
if (str.indexOf(at,(lat+1))!=-1){
return "Invalid E-mail ID"
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return "Invalid E-mail ID"
}
if (str.indexOf(dot,(lat+2))==-1){
return "Invalid E-mail ID"
}
if (str.indexOf(" ")!=-1){
return "Invalid E-mail ID"
}
return "";
}
and to check the existence of mail .. send a mail . keep try catch block .. i am not sure whether it will solve ur problem but syntax validation can be done by the above one
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
Krazy Programmer wrote: and to check the existence of mail .. send a mail
In short...this is called spamming.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
email validation should be done without sending mail
Maniiiiiiiiiiiiiii
|
|
|
|
|
i have to validate email domain without sending mail to that id,do anybody have the ans.
Maniiiiiiiiiiiiiii
|
|
|
|
|
Dont post your complete code...Pin point your problem....
For validation, have you ever heard of regular expression validators?
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
regular expression only validates syntax not domain of email id.
Maniiiiiiiiiiiiiii
|
|
|
|
|
mnkh wrote: regular expression only validates syntax not domain of email id.
That is what called validation...rite?
And there is no way to know weather domain/email id exists, without sending the email...
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
that is what i am asking is there any other way to validate email domain without sending email,in code project articles there is something given to validate email domain but dat was not working.i am using the code above posted,can anyone corrects dat.
Maniiiiiiiiiiiiiii
|
|
|
|
|
Hi...
I have created one class file XYX.cs under app_code directory...
and One usercontrol ABC.ascx file under usercontrol directory....
Now i want to get object of ABC.ascx file in XYX.cs file....
here both file namespace are similar...
But my problem is i cannot get object of that .ascx file in .cs file..
If i put that usercontrol file in .cs file than i am getting object...
but i dont want to put that user control in app_code....directory...
Is there any Solution for this....
?
?
?
Please help me...
Thankyou
Hemant Patel
|
|
|
|
|
Hi All,
I've exclusivly opened Mdb file. If I access in appln, I'm getting error such File is in use. By closing that, I can access that file. I want to check whether it is opened exclusively or not. Can u plz tell me how to check? Tnx in adv.
Balasubramanian K.
|
|
|
|
|
Try it with DSN.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Tnx for ur reply. I'm not clear abt DSN. Can u plz explain.
Balasubramanian K.
|
|
|
|
|
have you checked the Database source name is connected with the connection string and try it using the try catch and catch the exception.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Without the way of error, I want to check the file is opened or not.
Balasubramanian K.
|
|
|
|
|
Use Simply Try - Catch Block if Exception occured then give the message.
|
|
|
|
|
By error only, we r saying the msg.
I need to check like How we r checking the conn string. is opened or not. As well as, I need to check the mdb file is opened or not, If it is opened, I have to throw msg to say close it..
Balasubramanian K.
|
|
|
|
|
BalasubramanianK wrote: I need to check like How we r checking the conn string. is opened or not
I think ther is a propery with Connetion Class
Try to Check with that
Coon is your Connection
Conn.Status
it will give you the result !!!! Please check it and let me know.
BalasubramanianK wrote: , I need to check the mdb file is opened or not, If it is opened, I have to throw msg to say close it..
If the mdf file is open , it should throw the exception isnt it!!!
now
try
{
//Try to open connection
//If file is open then it should throw the exception
}
catch
{
//Handeld Exception
}
|
|
|
|
|
Tnx Mr. Jana..If there any other way, just u tell me.
Balasubramanian K.
|
|
|
|
|
try<br />
{<br />
}<br />
Catch<br />
{<br />
}
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you then save my time by voting my post.
|
|
|
|
|
Actually, I need to check the mdb file is opened or not. I dont want to throw msg, if error exists. If file is opened I want to say to close the file...Tnx for ur reply
Balasubramanian K.
|
|
|
|
|
Open the file for exclusive access and catch the exception if it fails:
<br />
File.Open(Path, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you then save my time by voting my post.
|
|
|
|
|
Is there anything like connection state?
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
|
ok thank you
Balasubramanian K.
|
|
|
|
|
any one please help me
I have the following code for Emailing .
My doubt is I am able to send mail only to gmail(as a spam) but not to other mail like yahoo(not even as a spam) etc. What could be the reason .I have even configured web.config file and ....Relay->127.0.0.1
kindly help me
Thanks in advance
---------->
//create the mail message
MailMessage mail = new MailMessage();
//set the addresses
mail.From = new MailAddress(txtFrom .Text.Trim ());
mail.To.Add(txtTo.Text.Trim ());
//set the content
mail.Subject = txtSubject .Text ;
//first we create the Plain Text part
AlternateView plainView = AlternateView.CreateAlternateViewFromString("Some Plain Text" , null, "text/plain");
//then we create the Html part
AlternateView htmlView = AlternateView.CreateAlternateViewFromString("<b>"+txtBody .Text.Trim ()+"</b>", null, "text/html");
mail.AlternateViews.Add(plainView);
mail.AlternateViews.Add(htmlView);
//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1"); //specify the mail server address
try
{
smtp.Send(mail);
Response.Write("Mail Sent...");
txtBody.Text = "";
txtFrom.Text = "";
txtSubject.Text = "";
txtTo.Text = "";
}
catch (Exception ex)
{
Response.Write (ex.ToString ());
}
<---------->Kovuru Sreedhar
|
|
|
|