Subject: how to remove this CDO error
Posted By: p2pMember Post Date: 9/14/2005 6:34:29 AM
ActiveX component can't create object: 'CDO.Message'

m getting this error with following asp page

<%@ Language=VBScript %>
<HTML>
    <HEAD>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <script id=clientEventHandlersJS language=vbscript>


function Button1_onclick()
    set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mailid@mydomain.com"
    myMail.To="mailid@somedomain.com"
    myMail.HTMLBody = "<h1>This is a message.</h1>"
    myMail.Send
    set myMail=nothing
end function


</script>
</HEAD>
    <body>
        <DIV ms_positioning="GridLayout">
            <TABLE height="408" cellSpacing="0" cellPadding="0" width="472" border="0" ms_2d_layout="TRUE">
                <TR vAlign="top">
                    <TD width="64" height="64"></TD>
                    <TD width="408"></TD>
                </TR>
                <TR vAlign="top">
                    <TD height="344"></TD>
                    <TD><INPUT id="Button1" type="button" value="Button" name="Button1" onclick="Button1_onclick()"></TD>
                </TR>
            </TABLE>
        </DIV>
    </body>
</HTML>
Reply By: Prabhakar_dt Reply Date: 9/26/2005 4:19:35 AM
Hi..All sever does not support CDO. First check which Mail component your server is supporting then try it...




Prabhakar Kumar
Reply By: p2pMember Reply Date: 10/3/2005 8:39:51 AM
oh! no.... i was to ask that how shud i call these things on button click..
wtever i did in function Button1_onclick()
if i put that stuff on page load...it works....
but m not getting how shall i do that on button click...
Reply By: ChrisScott Reply Date: 10/6/2005 4:00:25 AM
The reason you were getting that error was that the code was running client-side & your browser would not allow it to create ActiveX controls not marked as safe. This approach requires that all users use IE and have CDO on their machines which IMHO is undesirable.

A simple way to do what you want in classic asp is to submit a form to another page and send the mail from there server-side.

HTH,

Chris


Go to topic 35276

Return to index page 459
Return to index page 458
Return to index page 457
Return to index page 456
Return to index page 455
Return to index page 454
Return to index page 453
Return to index page 452
Return to index page 451
Return to index page 450