Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 serverside email validation

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-05-20 : 13:04:42
Yello !
has anyone got any pointers, code snippets, scripts on server side email validation in VB script ?

thanks
Afrika

Kristen
Test

22859 Posts

Posted - 2006-05-20 : 13:34:46
Its a minefield. If you read the RFC its Open Season for what is actually permitted before and after the '@'. Pretty much the only thing you aren't allowed is more than one @ - but even that is permitted if the other(s) are before the main one, and enclosed in quotes ...

... so!!! ... your best bet is to do an MX check on the email address - that will have the additional benefit that some Email servers will actually reject [otherwise valid] email addresses that have no mailbox.

(We use Easy Mail Objects for our Server Side stuff - that's the only one I know, and there are others for sure, but we're very happy with it)

Kristen
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-05-20 : 16:31:00
nice advice. But how do i check an MX record on the fly....
...if this is what you are implying ?
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-20 : 16:41:06
Have a look at his
http://vyaskn.tripod.com/handling_email_addresses_in_sql_server.htm

not vbscript but not difficult to convert.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-21 : 03:22:02
"But how do i check an MX record on the fly...."

You send an Email, except you only doing the bit of checking that it is deliverable, rather than actually sending a complete one (this is refered to as an "MX Lookup")

"...if this is what you are implying ?"

Yup!

Kristen
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-05-21 : 07:42:38
Thanks for your advice,
am reading up Nigels referred link.

But Kristen, i dont understand ? Are you saying,...
...I send an email on the fly ?

-- this is no problem, using CDONTS or dundas mailer, but how do we check to see if it was delivered or failed "ON THE FLY" ??? Or are you implying to check manually ???

Tough cookie, i must say.
Afrika
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-21 : 07:53:27
The MX check is part of the SMTP service - it will report an error immediately if the Domain (and sometimes the mailbox) is not valid.

It doesn't actually send an email - it just goes through the "motions"

Kristen
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-05-22 : 04:46:12
Thanks for the advice Kristen, i still am a bit confused on how you can check this on the fly? Or is it done manually ?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-22 : 05:33:30
"i still am a bit confused on how you can check this on the fly"

You program your application to do the "MX" test, via an SMTP server, and it gets back an OK or Error code.

Have a look at a Google for mx email test

Kristen
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-05-22 : 10:58:39
Thanks a lot Kristen,

I guess there is no better way of an email validation, funny we never thought of it this way.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-22 : 11:10:43
Its the blighters who wrote the RFC who are to blame ... plus some legacy stuff like the old X400 "bang" addresses (which I believe are still catered for in the RFC).

So you can have

My.Name@MyDomain.com

that's not too hard. Then

My.Name@[1.2.3]

and

My'Name@MyDomain.com

which breaks quite a few checkers that I've seen.

and finally things like

"My@Name"@MyDomain.com

which breaks all of them!

The RFC guys should have said "A-Z and 0-9, hyphen underscore and non-trailing '.'" and then we could have just used a RegEx to validate it!

Kristen
Go to Top of Page
   

- Advertisement -