Previous Next

Thread: CDOSYS and .CreateMHTMLBODY

Last post 04-14-2008 4:57 PM by gilbo. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 04-12-2008, 5:49 AM

    • gilbo
    • Not Ranked
    • Joined on 04-12-2008, 5:35 AM
    • Posts 2
    • gilbo

    CDOSYS and .CreateMHTMLBODY

    I've moved from a CDONTS script that sent a email as a receipt for an order taht was made from an asp page

    With CDOSYS the .createMHTMLbody allows me to reference an HTML page only. When trying to send the asp page nothing happens.

    I've tried

    <%
        sch = "http://schemas.microsoft.com/cdo/configuration/"
     
        Set cdoConfig = CreateObject("CDO.Configuration")
     
        With cdoConfig.Fields
            .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
            .Item(sch & "smtpserver") = "smtp.mycompany.com"
            .update
        End With
     
        Set cdoMessage = CreateObject("CDO.Message")
     
        With cdoMessage
            Set .Configuration = cdoConfig
            .From = "me@mycompany.com"
            .To = "client@yourcompany.com"
            .Subject = "Sample CDO Message"
            .TextBody = "This is a test for CDO.message"
            .CreateMHTMLBody "file://c:/Websites/MyCompany/mail-attach.asp
            .Send
        End With
     
        Set cdoMessage = Nothing
        Set cdoConfig = Nothing
    %> 

     and also

             .CreateMHTMLBody "http://www.MyCompany/mail-attach.asp

    If I use and html file it works fine but my page needs to be asp

    Please help, I have trawled the forums around the world for two days and keep finding the same answers that don;t solve my problem or even mention that only html files are allowed.

    Gilbo  

     

     

     

  • 04-14-2008, 4:38 PM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 10:27 AM
    • Lawrenceville, NJ
    • Posts 3,447
    • IIS MVPs
    • tomkmvp

    Re: CDOSYS and .CreateMHTMLBODY

    If you need to process ASP code to produce the body, either move that code to this file or access the asp using this method:

    http://www.aspfaq.com/show.asp?id=2173

  • 04-14-2008, 4:57 PM In reply to

    • gilbo
    • Not Ranked
    • Joined on 04-12-2008, 5:35 AM
    • Posts 2
    • gilbo

    Re: CDOSYS and .CreateMHTMLBODY

     

    Cheers, that worked a treat, a little tweaking and hey presto!

    At last a solution, still feel that CDOSYS is a retrograde step over CDONTS doing this though

     

    Gilbo

Page 1 of 1 (3 items)
Page view counter