Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2004, 10:56 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default Wats the error in this code

Hi,

dim receiptto
    receiptto="[email protected]"
    set cdoconfig=CreateObject("CDO.configuration")
    set cdomsg=CreateObject("CDO.Message")

    with cdoconfig.Fields
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail8.webmail.com"

'this is the SMTP server setting in my outlook.

        .Update
    end with
    with cdomsg
        set .Configuration=cdoconfig
        .Fields("urn:schemas:mailheader:disposition-notification-to")=receiptto
        .Fields("urn:schemas:mailheader:return-receipt-to") =receiptto
        .From="[email protected]"
        .To="[email protected]"
        .Subject="Sample mail"
        .HTMLBody="<b>Hello</b>"
        .DSNOptions=4
        .Fields.update
        .Send
    end with
    set cdoconfig=nothing
    set cdomsg=nothing


    Response.Write "Mail sent"


I am getting the error ar .Send (Internal Server error 500
If i didnt use configuration, sending mail correctly. (Simple from, to, subject, htmlbody, send).


Thanx in advance


 
Old November 23rd, 2004, 10:25 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What error message are you getting? Internal Server error 500? You might want to change your browser setting to display more customized error message.

If you are using MS IE Then Tools-->Internet Options-->Advanced-->Uncheck Show friendly HTTP error message
Try this script change the SMTP server
**********************************************



<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
            .Item(cdoSendUsingMethod) = cdoSendUsingPort
            .Item(cdoSMTPServer) = "Your SMTP Mail"
            .Item(cdoSMTPServerPort) = 25
            .Item(cdoSMTPconnectiontimeout) = 10
            .Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

END SUB
fromWho = TRIM( Request.Form( "fromWho") )
toWho = TRIM( Request.Form( "toWho") )
Subject = TRIM( Request.Form( "Subject" ) )
Body = TRIM( Request.Form( "Body") )
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body


'Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
Response.redirect "confirmation.html"
' Any existing page can be used for the response redirect method
END IF
%>

<HTML>
<HEAD><TITLE>Email Form</TITLE></HEAD>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
<BR>TO: <INPUT NAME="toWho" TYPE="text" SIZE=40>
<BR>FROM: <INPUT NAME="fromWho" TYPE="text" SIZE=40>
<BR>SUBJECT: <INPUT NAME="Subject" TYPE="text" SIZE=40>
<BR><TEXTAREA NAME="Body" COLS=40 ROWS=5></TEXTAREA>
<BR><INPUT TYPE="SUBMIT" VALUE="Send Mail">
</FORM>
</HTML>
************************************************** ****

 
Old November 23rd, 2004, 08:53 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  Thax 4 u r reply. I solved this. But i wonder,
 i didnt use any configuration. Then only it is sending mail and requesting read receipt.

--------
Rajani






Similar Threads
Thread Thread Starter Forum Replies Last Post
Code error??? emyr BOOK: Beginning Java 2 1 October 31st, 2006 05:47 PM
Wats wrong??? Dsypher ASP.NET 1.0 and 1.1 Basics 2 October 5th, 2005 05:06 AM
Code error!?!? Brian Campbell BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 November 26th, 2004 07:47 PM
error in code bukky Classic ASP Databases 2 March 5th, 2004 07:10 PM
Error displayed with error trap code stoneman Access 4 February 28th, 2004 02:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.