SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot DirtDiga's Avatar
    Join Date
    Jan 2002
    Location
    Belize City, Belize
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem Sending Email in ASP

    I'm trying to learn asp, particualry so I can send mail from a form.

    I tried this code which I got from www.webmasterbase/article/596/22

    Code:
    <%
    Set Mail=Server.CreateObject(“CDONTS.NewMail”)Mail.To=”me@mydomain.com”
    Mail.From=”testing-my@SP-Script.com”
    Mail.Subject=”Just testing my script”
    Mail.Body=”Hey! I am sending this email through an ASP Page and guess what? I haven’t learnt much yet, but know that ASP is very powerful.”
    Mail.Send
    Set Mail=nothing
    %>
    I save the code in a file called sendING_email.asp
    When I try to execute the file I get this error:
    HTTP 500.100 - Internal Server Error - ASP error
    Internet Information Services

    --------------------------------------------------------------------------------

    Technical Information (for support personnel)

    Error Type:
    Microsoft VBScript compilation (0x800A0408)
    Invalid character
    /sending_email.asp, line 2, column 29
    Why isn't it working?

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well you *might* want to try and put the Mail.To on a new line... i dont know if this has anything to do with it but its line two...

    try it and see...

  3. #3
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, thats probably it. Check the line that the error you posted says. Line 2 is the line where you did that.

  4. #4
    SitePoint Zealot DirtDiga's Avatar
    Join Date
    Jan 2002
    Location
    Belize City, Belize
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, that's how I had it before I copied and pasted it into my question.

    I'm now testing the code on my local machine to see if it would work but I get the same error.

    The code actually looks like this:
    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000">
    <%
    Set Mail=Server.CreateObject(“CDONTS.NewMail”)
    Mail.To=”dave@belizeweb.com”
    Mail.From=”testing-my@SP-Script.com”
    Mail.Subject=”Just testing my script”
    Mail.Body=”Hey! I am sending this email through an ASP Page and 
    guess what? I haven’t learnt much yet, but know that ASP is very 
    powerful.”
    Mail.Send
    Set Mail=nothing
    %>
    
    
    </body>
    </html>
    And the error that I get:
    Error Type:
    Microsoft VBScript compilation (0x800A0408)
    Invalid character
    /sending_email.asp, line 9, column 29
    Set Mail=Server.CreateObject(“CDONTS.NewMail”)
    ----------------------------^


    Browser Type:
    Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

    Page:
    GET /sending_email.asp

    Time:
    Wednesday, March 20, 2002, 1:54:30 PM
    I still don't know what's wrong. Can someone help?

  5. #5
    SitePoint Addict
    Join Date
    Aug 2000
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your have a couple of problems.


    First One:
    Get rid of the funky quotes that you are using. You are using the ASCII & #148; character and ASP is looking for the & #34; ASCII character.

    Change this: ”
    To this: "


    Second One:
    Code:
    Mail.Body=”Hey! I am sending this email through an ASP Page and 
    guess what? I haven’t learnt much yet, but know that ASP is very 
    powerful.”
    Will throw an error due to the fact that it wraps to more than 1 line.


    Try this code instead and note that the only difference is the use of the proper quotes character and the fact that I am concatenating the lines of your Mail.Body. In addition be SURE to use a valid FROM address that is valid for the account or you will wait all day for that email that will never come

    Code:
    <%
    Set Mail=Server.CreateObject("CDONTS.NewMail")
    Mail.To="alexming@wilcointernet.net"
    Mail.From="alexming@wilcointernet.net"
    Mail.Subject="Just testing my script"
    Mail.Body="Hey! I am sending this email through an ASP Page " & _
    "and guess what? I haven’t learnt much yet, but know that ASP is very powerful."
    Mail.Send
    Set Mail=nothing
    %>


    HTH

  6. #6
    SitePoint Zealot DirtDiga's Avatar
    Join Date
    Jan 2002
    Location
    Belize City, Belize
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    If you are wondering why I am smiling it is because It's working now!

    Thank you!

    That was the best help and most straight forward answer I have received since I joined Sitepoint.


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
  •