Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 October 14th, 2005, 02:51 PM
Authorized User
Join Date: Jan 2005
Location: , , .
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default CDONTS will not Carbon Copy

I have a page that calls information from a form and inserts the info into an email message. I have used CDONTS several times in the past but I can not get it to carbon copy this time whether I use a called variable for the email address or hard code it as you will see below.

here is the code with debug statements intact.:(

any ideas?

    action = request("action")
    'cusID = request("cusID") coming from firstcontact.asp

    spID = request.cookies("spID")
            response.write "Debug carbon copy is " & carboncopy2 &""

    sql = "select sname1,sname2,saleemail from salepeople where spID=" & spID
    response.write "Debug SQL is " & sql &""
    set sale = conn.execute(sql)

    salesmanemail = sale("saleemail")
    response.write "Debug salesmanemail is " &salesmanemail &""

    salesmanname = sale("sname1") & " " & sale("sname2")
    response.write "Debug Salesmanname is " & salesmanname & ""

    sql = "select fname,lname,email from customers where cusID=" & cusID
    response.write "Debug SQL is " & sql &""
    set cust = conn.execute(sql)
    if not len(cust("email")) > 4 then
        customeremail = trim(request.form("customeremail"))

        customeremail = cust("email")
    end if
        response.write "Debug customeremail is " & customeremail &""

    customername = cust("fname") & " " & cust("lname")
        response.write "Debug customername is " & customername &""

    cc1 = carboncopy2
        'if cc1 = "" then cc1 = " "
        response.write "This is the carbon copy field...Debug ccl is: " & carboncopy2 &""

    subject = replace(request("subject"),"'","''")
        if len(subject) < 2 then subject = "No Subject"
        response.write "Debug subject is " & subject &""

    textbody = request("textbody2")
        response.write "Debug Text Body is " & textbody &""

    ctime = dateadd("h",2,time())
        response.write "Debug ctime is " &ctime&""

    sql = "insert into actiondetail (actdettime,actdetdate,to_name,from_name,spID,cusI D,actID,subject,notes)values"
    sql = sql & "(#"&ctime&"#,#"&date()&"#,'"&customername&"','"&s alesmanname&"',"&spID&","&cusID&",6,'"&subject&"', '"&textbody&"')"
    response.write "Debug SQL is " & sql
    set rs = conn.execute(sql)

    Set myMail = CreateObject("CDONTS.NewMail")
    myMail.From = salesmanemail
    myMail.To = customeremail

        myMail.Cc = "some@address.com"

    myMail.Subject = subject

    myMail.BodyFormat = 1
    myMail.MailFormat = 1
    myMail.Body = textbody
    set myMail = nothing
Old October 24th, 2005, 01:00 AM
Authorized User
Join Date: Jul 2004
Location: Barrie, Ontario, Canada.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts

I don't see a problem here. The most common mistake is an improperly formatted address. However, might I suggest that you consider moving up to CDO instead of CDONTS. Windows 2003/IIS6 and beyond, natively, does not support CDONTS anymore. It was a bastardized copy of CDO for WinNT and was kept in 2k for backward compatibility.

You can download a customizable sample here. It uses the pickup folder method, which works on most IIS servers and is the simplest.

If you wish to use a remote SMTP server check here:
Old October 24th, 2005, 02:56 PM
Authorized User
Join Date: Jan 2005
Location: , , .
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts

I found out that CDONTS will not carbon copy to the same address for instances.

To: my@email.com
CC: my@email.com

Niether will CDO from my own experiments...Which I did switch to by the way...

Also my mail server was killing the message because the from address was an address that did not exist

example: none@none.com

Thanks for your help though.

Similar Threads
Thread Thread Starter Forum Replies Last Post
using CDONTS maunishq ASP.NET 1.0 and 1.1 Basics 1 August 23rd, 2007 09:35 AM
Tab cycle in Carbon projects geoforsy BOOK: Beginning Mac OS X Programming 0 October 19th, 2005 09:38 AM
cdonts p2ptolu Classic ASP Databases 1 March 8th, 2005 11:48 AM
CDONTS preeti Wrox Book Feedback 1 August 11th, 2004 09:39 AM

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