Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts

    HTML Page through CDO

    Hello all. I am trying to send a dynamic ASP page thorugh and email using CDO, but I am having trouble figuring out how to call it. I have the following script:

    Code:
    Set oMail = Server.CreateObject("CDO.Message") 
    		Set oMailConfig = Server.CreateObject ("CDO.Configuration") 
    		
    		oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtpout.myserver.net" 
    		oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
    		oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
    		oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 
    		oMailConfig.Fields.Update 
    		
    		Set oMail.Configuration = oMailConfig 
    		oMail.From = "me@myemail.com"
    		oMail.To = "you@youremail.com"
    		oMail.Cc = ""
    		oMail.Bcc = ""
    		oMail.Subject = "Project and Task DELETED"
    		oMail.HTMLBody = "/email_Planned_Work_(form).asp?UserId="& Session(MM_Username)
    		oMail.Send 
    		
    		Set oMail = Nothing 
    		Set oMailConfig = Nothing
    I have also tried
    Code:
    oMail.HTMLBody = "www.mywebsite.com/rpts/email_Planned_Work_(form).asp?
    and the only thing I am getting is the following in the email:

    Code:
    /email_Planned_Work_(form).asp
    I have read about using CreateMHTMLBody, but then I get the error that the command isn't supported.

    Any help would be greatly appreciated.

    Parallon

  • #2
    New Coder
    Join Date
    Dec 2007
    Location
    UK
    Posts
    41
    Thanks
    1
    Thanked 7 Times in 7 Posts
    I'm not sure you can do this the way you want to.

    Here is how I would do it:

    Open the web page file (shown as test.txt) in a text stream then with each line and it to oMail.HTMLBody

    Code:
    <%
    Set fs=Server.CreateObject("Scripting.FileSystemObject")
    Set f=fs.OpenTextFile(Server.MapPath("test.txt"), 1)
    
    do while f.AtEndOfStream = false
    oMail.HTMLBody = oMail.HTMLBody & f.ReadLine
    loop
    
    f.Close
    Set f=Nothing
    Set fs=Nothing
    %>
    But the page that is read would have to be static. It cannot be an asp page as no preprocessing can be done... if you catch my drift!
    Remember if someone has answered your question then please use the 'thank user' button below their post.

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Thank you for your response. But, even with the simples code:


    Code:
    <table border="0" cellspacing="0" cellpadding="0">
    
    <tr>
    <td width="90" bgcolor="#000000"><div align="left"><span class="style9">Type of Work </span> </div></td>
    <td width="90" bgcolor="#000000"><div align="left"><span class="style9">Day of Week </span> </div></td>
    <td width="110" bgcolor="#000000"><div align="left"><span class="style9">Project</span> </div></td>
    <td width="150" bgcolor="#000000"><div align="left"><span class="style9">Description</span> </div></td>
    <td width="50" bgcolor="#000000"><div align="left"><span class="style9">Hours</span> </div></td>
    <td width="90" bgcolor="#000000"><div align="left"><span class="style9">Status</span> </div></td>
    <td width="150" bgcolor="#000000"><div align="left"><span class="style9">Comments</span> </div></td>
    </tr>
    
    
    </table>
    ... i get the following error:

    Code:
    Microsoft VBScript runtime error '800a01a8' 
    
    Object required: '' 
    
    /rpts/email_Planned_Work.asp, line 165
    Am I missing something?

    Thanks,

    Parallon

  • #4
    New Coder
    Join Date
    Dec 2007
    Location
    UK
    Posts
    41
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Please post line 165

    EDIT: Just tested it with the code you have provided and it works fine for me.
    Last edited by tonyyeb; 01-11-2008 at 06:38 PM.
    Remember if someone has answered your question then please use the 'thank user' button below their post.

  • Users who have thanked tonyyeb for this post:

    parallon (01-11-2008)

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Actually, after some rearranging things, removing some quotes, and just starting from a clean slate instead of trying to convert an existing page, I was finally able to get it.

    Thank you so much for your help in this matter.

    Parallon

  • #6
    New Coder
    Join Date
    Dec 2007
    Location
    UK
    Posts
    41
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Glad I could help
    Remember if someone has answered your question then please use the 'thank user' button below their post.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •