Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could not access 'CDO.Message' object.

Status
Not open for further replies.

whill1

Technical User
Feb 14, 2004
46
US
Hello,
I get this message when I run the following code:
The code is from ASP.Net WEB MATRIX PROJECT guided tour.
Ive gone over this many times to make sure that I followed the steps in the tour correctly.
I have WindowsXP, OfficeXP, .Net v1.1, & Visual Studio. I am using the Web Matrix Program To Build These tutorials. Default WinXP virtual SMTP server (default settings).
I do not know if I have to or how to set up email accts on my own SMPT server -- if that is required for this.
I am trying to send myself a test message using My email address in both to/from boxes. The email address i am using is through a provider - RR-. use cable modem....
The following code and a single form is all there is to this email sender app. the form opens fine. I get the error when I click the SEND button(1).

Thanks for any input,
whill1

Code:
<%@ Page Language="VB" %>
<script runat="server">

    ' Insert page code here
    '
    
    Sub Button1_Click(sender As Object, e As EventArgs)
    
            Try
    
    ' Build a MailMessage
    
    
    Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
    
    mailMessage.From = TextBox2.Text
    mailMessage.To = TextBox1.Text
    mailMessage.Subject = TextBox3.Text
    mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html
    mailMessage.Body = TextBox4.Text
    
    System.Web.Mail.SmtpMail.SmtpServer = "localhost"
    System.Web.Mail.SmtpMail.Send(mailMessage)
    
     Label2.Text = "Your Mail Was Sent."
    
            Catch exp As Exception
    
    Label2.Text = "There was an error sending mail: " & exp.Message
    
            End Try
    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <p>
            <asp:Label id="Label1" runat="server">E-Mail</asp:Label>
        </p>
        <p>
            <asp:Label id="Label2" runat="server" forecolor="Red"></asp:Label>
        </p>
        <p>
            <table width="80%">
                <tbody>
                    <tr>
                        <td>
                            <span><label><asp:Label id="Label3" runat="server">To:</asp:Label></label></span></td>
                        <td>
                            <asp:TextBox id="TextBox1" runat="server">whill1@wi.rr.com</asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label id="Label4" runat="server">From:</asp:Label></td>
                        <td>
                            <asp:TextBox id="TextBox2" runat="server">whill1@wi.rr.com</asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label id="Label5" runat="server">Subject:</asp:Label></td>
                        <td>
                            <asp:TextBox id="TextBox3" runat="server">This is a Test</asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Send"></asp:Button>
                        </td>
                        <td>
                            <asp:TextBox id="TextBox4" runat="server" TextMode="MultiLine" Width="100%" Rows="10">If you can read this my new program works!</asp:TextBox>
                        </td>
                    </tr>
                </tbody>
            </table>
        </p>
        <!-- Insert content here -->
    </form>
</body>
</html>
 
This is the ASP Classic forum. Your question might get a better response in forum855 (the ASP.NET forum).

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top