濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > 如何判斷電子郵件的地址格式是否正確?

如何判斷電子郵件的地址格式是否正確?

熱門標(biāo)簽:自適應(yīng)地圖標(biāo)注 重慶400電話哪里辦理 遼寧營(yíng)銷智能外呼系統(tǒng)價(jià)格多少 武漢如何辦理400電話 400電話是怎么申請(qǐng) 語音電銷機(jī)器人視頻 推銷電話機(jī)器人怎么打電話的 教育機(jī)構(gòu)地圖標(biāo)注 常州智能外呼電銷機(jī)器人如何

第一種辦法:

%

Function IsValidEmail(Email)

ValidFlag = False

If (Email > "") And (InStr(1, Email, "@") > 0) And (InStr(1, Email, ".") > 0) Then

atCount = 0

SpecialFlag = False

For atLoop = 1 To Len(Email)

atChr = Mid(Email, atLoop, 1)

If atChr = "@" Then atCount = atCount + 1

If (atChr >= Chr(32)) And (atChr = Chr(44)) Then SpecialFlag = True

If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True

If (atChr >= Chr(58)) And (atChr = Chr(63)) Then SpecialFlag = True

If (atChr >= Chr(91)) And (atChr = Chr(94)) Then SpecialFlag = True

Next

If (atCount = 1) And (SpecialFlag = False) Then

BadFlag = False

tAry1 = Split(Email, "@")

UserName = tAry1(0)

DomainName = tAry1(1)

If (UserName = "") Or (DomainName = "") Then BadFlag = True

If Mid(DomainName, 1, 1) = "." then BadFlag = True

If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True

ValidFlag = True

' 格式正確返回Ture

End If

End If

If BadFlag = True Then ValidFlag = False

' 格式不正確返回False。

IsValidEmail = ValidFlag

End Function

%>

 

    第二種辦法:

%
function IsValidEmail(email)

dim names, name, i, c

IsValidEmail = true
names = Split(email, "@")
if UBound(names) > 1 then
  IsValidEmail = false
  exit function
end if
for each name in names
  if Len(name) = 0 then
    IsValidEmail = false
    exit function
  end if
  for i = 1 to Len(name)
    c = Lcase(Mid(name, i, 1))
    if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) = 0 and not
IsNumeric(c) then
      IsValidEmail = false
      exit function
    end if
  next
  if Left(name, 1) = "." or Right(name, 1) = "." then
      IsValidEmail = false
      exit function
  end if
next
if InStr(names(1), ".") = 0 then
  IsValidEmail = false
  exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i > 2 and i > 3 then
  IsValidEmail = false
  exit function
end if
if InStr(email, "..") > 0 then
  IsValidEmail = false
end if

end function
%>

   
第三種辦法,用下面這個(gè)函數(shù)進(jìn)行判斷。它會(huì)檢查郵件地址是否含有“@”,以及“.”是否在@”后面:

function isEmail(pInString)

  lAt = False
  lDot = false

  for x = 2 to len(pInstring)-1
    if mid(pInString,x,1) = "@" then lAt = True
      if mid(pInString,x,1) = "." and lAt = True then lDot = True
  next

  if lAt = True and lDot = True then
    isEmail = True
  else
    isEmail = False
  end if
end function

 

[1]

標(biāo)簽:中山 雞西 邯鄲 柳州 襄陽(yáng) 威海 朔州 遵義

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《如何判斷電子郵件的地址格式是否正確?》,本文關(guān)鍵詞  如何,判斷,電子郵件,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《如何判斷電子郵件的地址格式是否正確?》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于如何判斷電子郵件的地址格式是否正確?的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    康平县| 东乡县| 千阳县| 白朗县| 漳浦县| 邳州市| 苏尼特右旗| 昌吉市| 临沭县| 冀州市| 望奎县| 昌图县| 巧家县| 同江市| 安岳县| 台前县| 桦川县| 洞口县| 彭山县| 五峰| 东乌| 成都市| 四会市| 乌鲁木齐县| 盐城市| 龙陵县| 南川市| 江阴市| 封开县| 柳州市| 子洲县| 巴里| 关岭| 时尚| 个旧市| 通河县| 尼勒克县| 抚松县| 会东县| 邵东县| 高青县|