SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Michigan
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CDONTS mail.to mismatch question

    Not sure if this is the right section for a CDONTS question but...

    I had a webmail CDONTS script working... quite well too I think

    I had an error saying mail.to had a type mismatch. I went through the database (it's a web form mailing list for a client) and found what I thought to be bad email addresses. Tried it again and it works fine.

    My question, is there anyway to validate the email address? I am assuming that CDONTS wants the text string to be in a certain format. How can I test the data for a valid format, and then throw out that email address if it is not in the expected format?

    Thanks in advance

    Skip

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a function you could use to validate any email address. Then you'd have to check each email address to make sure it passes (returns True) before calling SEND in CDONTS.

    Function IsValidMail(sEmail)
    Dim objRegExp
    Set objRegExp = New RegExp
    objRegExp.Pattern = "^[a-z._-]+\@[a-z._-]+\.[a-z]{2,4}$"
    objRegExp.IgnoreCase = True
    IsMail = objRegExp.Test(sEmail)
    End Function
    in1.com | Bootply - Bootstrap playground


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •