Sending a simple Email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • migi
    New Member
    • Sep 2008
    • 4

    Sending a simple Email

    Hi! I'm newbie with ASP and I have a simple task to do. I should send email using IIS.
    So I created html-file, which calls asp.page:

    Code:
    <html>
    <form action="test.asp" method="POST">
    <input type="submit" VALUE="Send">
    </Form>
    </html>
    The asp-page is another simple example, test.asp:

    Code:
    <html>
    <body>
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="mikko.bothas@digia.com"
    myMail.TextBody="This is a message."
    myMail.Send
    set myMail=nothing
    %>
    <h3> Message has been sent!
    </h3>
    </body>
    </html>
    When I open the html-file and press the submit button, all I see is the code inside the asp-file. So obviously this doesn't work. Any ideas what might be wrong?
    I've added smtp-service to IIS and configured it to use smart host.
    Any help is highly appreciated!
    Last edited by DrBunchman; Sep 29 '08, 07:50 AM. Reason: Added [Code] Tags - Please use the '#' button
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi migi,

    Are you running this website through the IIS? If not your ASP page will just be rendered as html which sounds like the case here.

    If you need help setting up your website in IIS then let me know.

    Dr B

    Comment

    • migi
      New Member
      • Sep 2008
      • 4

      #3
      Originally posted by DrBunchman
      Hi migi,

      Are you running this website through the IIS? If not your ASP page will just be rendered as html which sounds like the case here.

      If you need help setting up your website in IIS then let me know.

      Dr B
      Yes, we have IIS. But if you could guide me to use those two files, it would be great.

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Set up a virtual directory under the default website in the IIS, giving it a name and pointing it to the folder where your two files are. You should then be able to view them by browsing

        //<servername>/<virtualdirecto ry>/<pagename>

        So if you set up a virtual directory called Test on your local machine the URL would be

        //127.0.0.1/Test/test.html

        Submitting the form should now load the ASP page through the IIS correctly. Does this make sense? Let me know how it goes.

        Dr B

        Comment

        • rajujrk
          New Member
          • Aug 2008
          • 107

          #5
          Actually your code is perfect

          But it will not execute on localhost

          after you host it on your web in any server

          it will work fine..

          try CDONTS.NewMail

          Thank you

          With Regards
          JRK

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            JRK,

            Why won't it work on localhost? As long as the script is configured to use the default smtp service correctly it should work fine.

            And why would use use CDONTS? CDONTS is a deprecated mail object and you should use CDOSYS nowadays.

            Dr B

            Comment

            • sashi
              Recognized Expert Top Contributor
              • Jun 2006
              • 1749

              #7
              Dear Everyone,

              First of all i think someone has to brief her on setting up IIS on her XP box. Miqi, please take note, IIS is only supported on XP Pro version. Kindly follow the below links for further reading and research, happy coding.

              1. Install & Configuring IIS on XP Pro

              2.Configuring IIS Virtual SMTP Server

              Comment

              Working...