Check email syntax
[1/5] from: r3b0l:free at: 31-Jan-2004 16:47
Hi all,
In order to improve an email syntax checking function, i am searching a command to do
the same thing as
checkdnsrr("rebol.com", "MX") in PHP
who perform a search in DNS record (return true if found a record).
I presume i could replace a regular expression like "^[_\.0-9a-z-]+@([0-9a-z-]+\.)+[a-z]{2,4}$"
with his equivalent in a big parse or something like that ;-)
Any suggestions welcome (i'd like to replace some old PHP scripts by a small Rebol script
;-)
AMIGAlly,
Arnaud aka bigdan
East of France, Europe
--
Arnaud Danassie <rebol "at" migazone "dot" com>
Amiga and Pegasos user (http://www.pegasosppc.com fo details)
[2/5] from: tomc::darkwing::uoregon::edu at: 31-Jan-2004 20:07
hello Arnaud
a minimal email DNS checker could be as simple as
read join dns:// next find email "@"
but if you really want a maximal validating parser per RCF821 ...
you can make some rules, these were derived from
http://www.freesoft.org/CIE/RFC/821/15.htm
a: charset [#"A" - #"Z" #"a" - #"z"]
d: charset {0123456789}
special: charset [ #"^(00)" - #"^(1F)" #"^(7F)"
#"<" #">" #"(" #")" #"[" #"]" #"\" #"." #"," #";" #":" #"@" #"^""
]
snum: [["25" ["0" | "1" | "3" | "4" | "5"]] |
["2" ["0" | "1" | "3" | "4"]d] |["1" 2 d] | [1 2 d]
]
qc: complement charset [#"^(10)" #"^(13)" #"^"" #"\"]
c: complement union special charset " "
x: ["\" skip]
dotnum: [snum "." snum "." snum "." snum]
number: [some d]
let-dig: union a d
ldh-str: [some [let-dig | "-"]]
name: [a ldh-str]
element: [["#" number] | ["[" dotnum "]"] | name]
domain: [element any ["." element]]
qtext: [some [qc |x ]]
char: [c | x]
string: [some char]
quoted-string: ["^"" qtext "^""]
dot-string: [[string "." dot-string] | string]
local-part: [dot-string | quoted-string]
mailbox: [local-part "@" copy dmn domain (dns: read join dns:// dmn)]
; to use these rules ...
email: [r3b0l--free--fr]
dns: none
parse/all email mailbox
dns
HTH
On Sat, 31 Jan 2004 [r3b0l--free--fr] wrote:
[3/5] from: gchiu:compkarori at: 1-Feb-2004 9:23
[r3b0l--free--fr] wrote.. apparently on 31-Jan-2004/16:47:33+1:00
>checkdnsrr("rebol.com", "MX") in PHP
>
Like
read dns://www.rebol.com
--
Graham Chiu
http://www.compkarori.com/cerebrus<
[4/5] from: g:santilli:tiscalinet:it at: 1-Feb-2004 12:33
Hi Tom,
On Sunday, February 1, 2004, 5:07:23 AM, you wrote:
TC> a minimal email DNS checker could be as simple as
TC> read join dns:// next find email "@"
Notice that:
>> email: [r3b0l--free--fr]
== [r3b0l--free--fr]
>> email/user
== r3b0l
>> email/host
== free.fr
Anyway, that will look for A (or CNAME) records, not MX ones.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[5/5] from: bry:itnisk at: 5-Feb-2004 11:09
> Notice that:
> >> email: [r3b0l--free--fr]
<<quoted lines omitted: 3>>
> >> email/host
> == free.fr
heh, just struck me that this is a quick
hack to do name value pairings.
what if you had a block of 'addresses'?
(not at home so I can't start rebol right
now)
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted