WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Simple Email Parsing Code
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
99999999
Junior Member

Registered: Nov 2006
From:

Simple Email Parsing Code

code:
VAR $USEREMAILADDRESS Function CheckUserEmailAddress StrCpy $R1 $USEREMAILADDRESS StrCpy $R2 "" StrCpy $R3 "" #count the number of @'s more than one is invalid, less than one is invalid ${WordFind} "$USEREMAILADDRESS" "@" "*" $R1 StrCmp "1" "$R1" lbl_check2 lbl_error lbl_check2: #count the number of words delimited by @ it should be 2. ${WordFind} "$USEREMAILADDRESS" "@" "#" $R1 StrCmp "2" "$R1" lbl_check3 lbl_error lbl_check3: #Split the words into user and domain ${WordFind} "$USEREMAILADDRESS" "@" "0" $R2 ${WordFind} "$USEREMAILADDRESS" "@" "1" $R3 #Determine if either of the fields contain special RFC822 characters ${StrFilter} "$R2" "" "" '()<>,;:\"[]' $R1 StrCmp "$R2" "$R1" 0 lbl_error ${StrFilter} "$R3" "" "" '()<>,;:\"[]' $R1 StrCmp "$R3" "$R1" 0 lbl_error lbl_check4: #Determine the number of fields in user and domain, check to see the number of delimiter is one less than the number of words. ${WordFind} "$R2" "." "*" $R5 ${WordFind} "$R2" "." "#" $R6 IntOp $R5 $R5 + 1 StrCmp "$R5" "$R6" 0 lbl_error ${WordFind} "$R3" "." "*" $R5 ${WordFind} "$R3" "." "#" $R6 IntOp $R5 $R5 + 1 StrCmp "$R5" "$R6" lbl_check5 lbl_error lbl_check5: # make sure there is at least one "." in the domain section. ${WordFind} "$R3" "." "*" $R1 IntCmp 1 $R1 lbl_end lbl_end lbl_error goto lbl_end lbl_error: SetErrors lbl_end: FunctionEnd


This function takes the contents of "$USEREMAILADDRESS" and then sets the error flag, if the email address did not meet the simple validation rules. This covers pretty much all you could check, just by looking at an email address as a text string, and without any online verification.

Quick Link | Report this post to a moderator | IP: Logged

99999999 is offline Old Post 03-07-2007 01:32 AM
Click Here to See the Profile for 99999999 Click here to Send 99999999 a Private Message Click Here to Email 99999999 Find more posts by 99999999 Add 99999999 to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

Cool
If you post the example at wiki, would be easily accessible by everyone.

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 03-08-2007 06:47 AM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
Backland
Senior Member

Registered: Sep 2006
From:

Great function, thanks for contributing

Quick Link | Report this post to a moderator | IP: Logged

Backland is offline Old Post 03-08-2007 08:12 AM
Click Here to See the Profile for Backland Click here to Send Backland a Private Message Click Here to Email Backland Find more posts by Backland Add Backland to your buddy list Edit/Delete Message Reply w/Quote
99999999
Junior Member

Registered: Nov 2006
From:

While I have an account on the Wiki, I don't seem to be able to add pages to it.

quote:
Originally posted by Red Wine
Cool
If you post the example at wiki, would be easily accessible by everyone.

Quick Link | Report this post to a moderator | IP: Logged

99999999 is offline Old Post 03-08-2007 06:44 PM
Click Here to See the Profile for 99999999 Click here to Send 99999999 a Private Message Click Here to Email 99999999 Find more posts by 99999999 Add 99999999 to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Jerusalem, Israel

Everyone can add pages. See the following FAQ item:

http://nsis.sourceforge.net/Starting_a_new_page

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 03-08-2007 06:48 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
99999999
Junior Member

Registered: Nov 2006
From:

Allrighty it's at http://nsis.sourceforge.net/Email_Validation_Function now. Bit spoiled by the Wiki we have here at work.

Quick Link | Report this post to a moderator | IP: Logged

99999999 is offline Old Post 03-08-2007 06:59 PM
Click Here to See the Profile for 99999999 Click here to Send 99999999 a Private Message Click Here to Email 99999999 Find more posts by 99999999 Add 99999999 to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

URL:
http://nsis.sourceforge.net/Email_Validation_Function

I think would be nice if you add a complete example of usage as well

edit: Also you need to add it in a category.

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 03-08-2007 07:02 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
99999999
Junior Member

Registered: Nov 2006
From:

quote:
Originally posted by Red Wine
URL:
http://nsis.sourceforge.net/Email_Validation_Function

I think would be nice if you add a complete example of usage as well

edit: Also you need to add it in a category.




Thanks for converting this for me RedWine. I happened to look here for this type of code, and couldn't find it, so I just wanted to give back to you use for your help.

Quick Link | Report this post to a moderator | IP: Logged

99999999 is offline Old Post 04-04-2007 08:06 PM
Click Here to See the Profile for 99999999 Click here to Send 99999999 a Private Message Click Here to Email 99999999 Find more posts by 99999999 Add 99999999 to your buddy list Edit/Delete Message Reply w/Quote
Comm@nder21
Major Dude

Registered: Jul 2003
From: germany, b-w

well, this function is still to be optimized

(write the checks on your own, without using the WordFind stuff, they add a lot of overhead by unused functionality)

maybe i'll do that some time

__________________
hand by comm@nder21
----------
WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility

Quick Link | Report this post to a moderator | IP: Logged

Comm@nder21 is offline Old Post 04-05-2007 04:52 PM
Click Here to See the Profile for Comm@nder21 Click here to Send Comm@nder21 a Private Message Click Here to Email Comm@nder21 Visit Comm@nder21's homepage! Find more posts by Comm@nder21 Add Comm@nder21 to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:25 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Simple Email Parsing Code
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON