Siv Tau Email Chaw Nyob Ntev

Depositphotos 1948865 s

Kuv yuav tsum tau ua qee tus khawb hnub no kom pom nws, tab sis koj puas paub qhov ntev ntawm qhov chaw nyob email yog dab tsi? Nws yeej tau tawg mus rau qhov chaw… Npe@Domain.comCov. Qhov no yog raws li RFC2822.

  1. Lub npe tuaj yeem yog 1 txog 64 cim.
  2. Sau tau yuav 1 txog 255 cim.

Wow ... uas txhais tau tias qhov no yuav yog ib qho siv tau email:


loremaipsumadolorasitaametbaconsectetueraadipiscin
gaelitanullamc @ loremaipsumadolorasitaametbaconsect
etueraadipiscingaelitcaSedaidametusautanisiavehicu
laaluctuscaPellentesqueatinciduntbadiamaidacondimn
pob txhawsrumbaturpisamassaaconsectetueraarcubaeuatin
ciduntaliberoaaugueavestibulumaeratcaPhasellusatin
ciduntaturpisaduis.com

Sim ua kom haum rau ntawm daim npav ua lag luam! Ironically, feem ntau cov email chaw nyob tsuas yog txwv rau 100 tus cim hauv web. Tias 's yeej tsis siv tau. Yog tias koj xav lees paub qhov chaw nyob email rau kev tsim kho zoo siv PHP, Kuv pom qhov snippet no ntawm net:

http://derrick.pallas.us/email-validator/ # Ntawv Tso Cai: Kawm Ntawv Tso Cai Dawb 2.1 # Version: 2006-12-01a yog (! ereg (''. '^'. '[-! # $% & \ '* + / 0-9 =? AZ ^ _a-z {|} ~]'. '(\\.? [-! # $% & \' * + / 0-9 =? AZ ^ _a-z { |} ~]) * '.' @ '.' [a-zA-Z] (-? [a-zA-Z0-9]) * '.' (\\. [a-zA-Z] (- ? [a-zA-Z0-9]) *) + '.' $ ', $ email)) rov qab cuav; sau npe ($ hauv zos, $ sau) = sib faib ("@", $ email, 2); yog tias (strlen ($ hauv zos)> 64 || strlen ($ domain)> 255) rov qab cuav; yog ($ check & &! gethostbynamel ($ domain)) rov qab cuav; rov qab muaj tseeb; # POJ NIAM ###### Suav Teb}

9 Comments

  1. 1
  2. 2

    Yog lawm, Kuv pom qhov tsis ua raws li lwm cov kev daws teeb meem nrog RFC zoo ib yam. Kuv tau pom, txawm tias, txawm tias qhov regex no yog atypical thiab tsis yog tus qauv. Kuv nco ntsoov nyeem qhov tseeb regex (tso cai <,>, thiab lwm yam) yog qhov muaj zog heev rau cov txheej txheem feem ntau.

    Txawm li cas los xij, nws tau sau succinctly thiab lus meej yog kev daws teeb meem uas yuav tsum tau lees paub rau ib qho kev thov kev lag luam email.

    Ua Tsaug, Dua!
    Doug

  3. 3

    Hmoov tsis zoo, Kuv txuas nplooj ntawv ntawd mus rau RFC tsis yog (2821 hloov ntawm 2822) tab sis qhov ntawd tau raug kho. Lub kaum sab xis nkhaus tsis tuaj yeem ua ib feem ntawm lub zos lossis chaw sau npe ntawm email chaw nyob; theej, lawv sawv cev rau tokenization cov ntsiab lus, piv txwv li lawv tuaj yeem siv los nyob ib puag ncig email chaw nyob (piv txwv hauv koj tus neeg xa ntawv xa ntawv) ncaj qha vim tias lawv tsis tuaj yeem ua ib feem ntawm chaw nyob

    Ib qho uas kuv txoj haujlwm tsis ua yog txhawj xeeb txog tsab ntawv uas hais los ntawm email chaw nyob - qhov chaw hauv zos tshwm nyob rau hauv ob kab lus - vim RFC2821 qhov tseem ceeb hais tias tsis muaj leej twg yuav tsum tau sau lawv qhov chaw nyob ntawd. (Kuv ntseeg tias daim foos no yog rov qab ua tau zoo thiab yog qhov kev coj ua tsis zoo.)

  4. 4
  5. 5

    Muaj kev txwv hauv RFC 2821 ntawm qhov ntev ntawm qhov chaw nyob hauv MAIL thiab RCPT cov lus txib ntawm 256 tus cim. Kev txwv sab sauv ntawm qhov chaw nyob ntev yuav tsum xam pom tias yog 256.

    - Tau qhov twg los: RFC 3696 Errata

    Tsis tas li, vim RFC 2181 hais tias "Lub npe sau npe tag nrho tsuas yog 255 octets", nws tau hais ntau yam los ntawm cov neeg (suav nrog cov kws sau ntawv ntawm lwm RFCs) raws li lub ntsiab lus tias cov npe sau npe tuaj yeem yog 255 chars ntev. Tab sis RFC2181 tab tom tham txog DNS kev cai-theem sawv cev ntawm cov hlau, tsis tuaj yeem sau cov cim.

    Qhov ntev tshaj plaws ntawm tus sau npe yog 253 chars (254 suav nrog cov dot tom qab, 255 octets ntawm cov hlau nrog kev txiav tawm haujlwm). Thiab ntawd yog dab tsi KHI thiab DiG siv.

  6. 6
  7. 7
  8. 8

Yuav ua li cas koj xav hais tias?

Qhov Web site no siv Akismet los txo cov kev pabcuam. Kawm li cas koj cov ntaub ntawv tawm tswv yim tiav.