CDOSYS - IF NOT A VALID EMAIL

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default CDOSYS - IF NOT A VALID EMAIL

    with the cdosys script i have, it works fine if you have a dim email that is an
    email address, but if a user were to leave that field blank, or not enter a
    valid email format, they will get an error if left blank: CDO.Message.1 error
    '8004020c' At least one recipient is required, but none were found. if
    something non email was entered (like 'abc123'): error '8004020f' i need to be
    able to have the script not run and/or cause an error, if the informaiton
    submitted is missing or incorrect (and no form check suggestions please) Here
    is the code: <% If (CStr(Request('MM_insert')) <> '') Then Set usxMsg =
    CreateObject('CDO.Message') Set usxConf = CreateObject('CDO.Configuration')
    Dim email email=Request.Form('email') ' Set the SMTP Server Set Flds =
    usxConf.Fields With Flds ' Port
    '.Item('http://schemas.microsoft.com/cdo/configuration/smtpserverport') = 25
    ..Item('http://schemas.microsoft.com/cdo/configuration/smtpauthenticate') = 1
    ..Item('http://schemas.microsoft.com/cdo/configuration/sendusername') =
    'jsteinmann'
    ..Item('http://schemas.microsoft.com/cdo/configuration/sendpassword') =
    'password' .Item('http://schemas.microsoft.com/cdo/configuration/sendusing') =
    2 .Item('http://schemas.microsoft.com/cdo/configuration/smtpserver') =
    'mail.site.com' 'SSL
    '.Item('http://schemas.microsoft.com/cdo/configuration/smtpusessl') = False
    'timeout in seconds
    '.Item('http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout')
    = 10 .Update End With With usxMsg Set .Configuration = usxConf .To = email
    ..From = 'site <address@site.com>' .Subject = 'subject' .HTMLBody = 'body'
    ..Fields.Update .Send End With Set Flds = Nothing Set usxMsg = Nothing Set
    usxConf = Nothing end if %>

    jsteinmann Guest

  2. Similar Questions and Discussions

    1. Email Scripts, CDOSYS, and Security
      I am a newbie with Dreamweaver and with ASP.NET. I created a form where the data is submitted to a SQL database and an email is sent notifying the...
    2. CDOSYS and smarthost
      I'm trying to send an email from my ASP page using CDO.Message and CDO.Configuration. I couldn't get this to work for ages and all my emails ended...
    3. Email::Valid cannot find itself when doing a make test.
      Anybody know how to get Email::Valid to locate itself so that valid.t will not fail because it cannot find the Email::Valid module?
    4. copy Attachement from Email on server (files copied are not valid)
      Hi, I'm getting emails from an address trough a script and I want to copy the attached files on the server. I can get the files and copy them on...
    5. asp/cdosys generated email using SMTP
      Show Code -- ---------------------------------------------------------- Curt Christianson (Software_AT_Darkfalz.Com) Owner/Lead Designer,...
  3. #2

    Default Re: CDOSYS - IF NOT A VALID EMAIL

    You would need to run a validation script on the email address when they
    enter it to check it is correctly constructed - bear in mind that these
    scripts are not perfect - i.e. you can't stop someone entering
    [email]notreal@qwerty.com[/email] for example as the scripts only check that the three
    email elements are in place (the bit before the @ - the bit between the @
    and the top level domain extension, and finally the TLD extension.

    With that in mind, if you wrap the piece of code that sends the email in an
    IF statement to check that an email address was supplied then you will at
    least stop the script from reporting an error on the page to the user.

    HTH
    Rob
    [url]http://robgt.com[/url]


    RobGT Guest

  4. #3

    Default Re: CDOSYS - IF NOT A VALID EMAIL

    can you show me an example of what thay would look like (wrapping the actual
    sending of an email in an if then statement)? basically, i'm not worried about
    bogus or missing entries (which i realize i can force with a yy_check form) at
    this point, i'm just worried about the user getting an error. With that in
    mind, if you wrap the piece of code that sends the email in an IF statement to
    check that an email address was supplied then you will at least stop the
    script from reporting an error on the page to the user. HTH Rob
    [url]http://robgt.com[/url]

    jsteinmann Guest

  5. #4

    Default Re: CDOSYS - IF NOT A VALID EMAIL

    Rob, if i add something like: if Request.Form('email') <> '' then above the
    dim, i can prevent the problem of a blank form causing the missing information
    error, but how do i wrap this so that the elements of an email must be present
    to perform the action without the use of a check_form script for the form
    itself?

    jsteinmann Guest

  6. #5

    Default Re: CDOSYS - IF NOT A VALID EMAIL

    If Request.Form("Email") <> "" Then
    'Your CDO code goes here
    Else
    'Do whatever you want to indicate to the user there was an error, or
    simply redirect to the next page if you don't care
    End If

    "jsteinmann" <webforumsuser@macromedia.com> wrote in message
    news:cvusio$jee$1@forums.macromedia.com...
    > can you show me an example of what thay would look like (wrapping the
    actual
    > sending of an email in an if then statement)? basically, i'm not worried
    about
    > bogus or missing entries (which i realize i can force with a yy_check
    form) at
    > this point, i'm just worried about the user getting an error. With
    that in
    > mind, if you wrap the piece of code that sends the email in an IF
    statement to
    > check that an email address was supplied then you will at least stop the
    > script from reporting an error on the page to the user. HTH Rob
    > [url]http://robgt.com[/url]
    >

    CMBergin Guest

  7. #6

    Default Re: CDOSYS - IF NOT A VALID EMAIL

    Hi,
    You would do this as per CMBergins post.
    Cheers,
    Rob


    RobGT Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139