Ubude beDilesi ye-imeyile

Iidipozithi iifoto 1948865 s

Kwafuneka ndenze ukumba namhlanje ukuze ndiyifumane, kodwa ubusazi ukuba bubuphi ubude bedilesi ye-imeyile? Inene yaphulwe yangamacandelo… Igama@Domain.com. Oku kuhambelana I-RFC2822.

  1. Igama linokuba ngoonobumba aba-1 ukuya kuma-64.
  2. Isizinda sinokuba ngabalinganiswa aba-1 ukuya kuma-255.

Wow… oko kuthetha ukuba oku kunokuba yidilesi ye-imeyile efanelekileyo:


loremaipsumadolorasitaametbaconsectetueraadipiscin
Lumka @loremaipsumadolorasitaametbaconsect
etueraadipiscingaelitcaSedaidametusautanisiavehicu
I-laaluctuscaPellentesqueatinciduntbadiamaidacondimn
tumarutrumbaturpisamassaaconsectetueraarcubaeuatin
ciduntaliberoaugueavestibulumaeratcaPhasellusatin
ciduntaturpisaduis.com

Zama ukuyifaka kwikhadi leshishini! Ngelishwa, uninzi lweedilesi ze-imeyile zikhawulelwe kubalinganiswa abali-100 kwiwebhu. Ngokuqinisekileyo ayisebenzi. Ukuba ungathanda ukuqinisekisa idilesi ye-imeyile yolwakhiwo olufanelekileyo usebenzisa i-PHP, ndiyifumene le snippet kumnatha:

http://derrick.pallas.us/email-validator/ # Ilayisensi: Ilayisensi yasimahla yezifundo 2.1 # Inguqulelo: 2006-12-01a ukuba (! 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]) *) + '.' $ ', $ imeyile)) buyela ubuxoki; Uluhlu ($ lwasekhaya, idomain) = ukwahlula ("@", imeyile yeedola, 2); ukuba (strlen ($ local)> 64 || strlen ($ domain)> 255) buyela ubuxoki; ukuba ($ jonga &&! gethostbynamel ($ domain) buyela ubuxoki; buyela yinyani; # ISIPHELO ###### }

9 Comments

  1. 1
  2. 2

    Ewe, ndiqaphele ukunqongophala kokuthotyelwa kwezinye izisombululo kunye ne-RFC. Ndiqaphele, nangona, ukuba le regex ayifani kwaye ayingomgangatho. Ndikhumbula ukufunda i-regex yokwenyani (ukuvumela <,>,,, njalo njalo) kunzulu kakhulu kwiinkqubo ezininzi.

    Nangona kunjalo, ibhalwe ngokufutshane kwaye ngokuqinisekileyo isisombululo esifanele ukuba samkelwe kuso nasiphi na isicelo se-imeyile yeshishini.

    Enkosi kwakhona!
    Doug

  3. 3

    Ngelishwa, ndidibanise elo phepha kwi-RFC engalunganga (2821 endaweni ye-2822) kodwa oko kulungisiwe. Izibiyeli ze-engile azinakuba yinxalenye yendawo okanye indawo ye-domain yedilesi ye-imeyile; endaweni yoko, zimele amanqaku ophawu, okt zingasetyenziswa ukurhangqa idilesi ye-imeyile (umzekelo kwisifundi sakho semeyile) ngokuthe ngqo kuba abanakuba yinxalenye yedilesi.

    Inye into engayenziyo umsebenzi wam kukuxhalaba malunga nefomu ecatshulweyo yeedilesi ze-imeyile-apho indawo yalapha ibonakala kwizicaphulo eziphindiweyo-kuba i-RFC2821 ngokusisiseko ithi akukho mntu kufuneka abhale idilesi yakhe ngolo hlobo. (Ndikholelwa ukuba le fomu yeyokuhambelana ngasemva kwaye ngoku kukuziphatha kakubi.)

  4. 4
  5. 5

    Kukho uthintelo kwi-RFC 2821 kubude bedilesi kwi-MAIL kunye nemiyalelo ye-RCPT enamagama angama-256. Umda ongaphezulu kubude bedilesi kufuneka uthathwe njengesiqhelo ngama-256.

    — Umthombo: RFC 3696 Errata

    Kwakhona, ngenxa yokuba i-RFC 2181 ithi "Igama lesizinda esipheleleyo lilinganiselwe kwii-octet ezingama-255", litolika ngokuphindaphindiweyo ngabantu (kubandakanywa nababhali bezinye ii-RFCs) njengoko kuthetha ukuba amagama e-domain anokuba yi-255 chars ubude. Kodwa i-RFC2181 ithetha malunga ne-DNS yokumelwa kwinqanaba leprotocol kucingo, hayi oonobumba abaprintwayo.

    Ubude obuphezulu begama lesizinda li-253 chars (254 kuquka i-dot elandelwayo, i-255 octets kwi-wire kunye nokuphelisa i-null). Kwaye yiloo nto i-BIND kunye ne-DiG izalisekisa.

  6. 6
  7. 7
  8. 8

Ingaba ucinga ntoni?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.