Results 1 to 6 of 6

Thread: Can this be done!?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Question Can this be done!?

    Hello,

    I want to dynamicaly create a HTML page/file and then send it as an attachment using
    ASPMail. Can it be done.

    Let's use this example

    Code:
    strbody = "<html>"
    strbody = strbody & "<body>"
    strbody = strbody & "<p>Testing, testing 123</p>"
    strbody = strbody & "</body>"
    strbody = strbody & "</html>"
    This, I now want to send as an attachment called "test.html"

    Can this be done??

    Thanks,
    T

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    I'm not too sure what ASPMail is, but I cheated when I needed tihs done :
    Code:
    strbody = "<html>"
    strbody = strbody & "<body>"
    strbody = strbody & "<p>Testing, testing 123</p>"
    strbody = strbody & "</body>"
    strbody = strbody & "</html>"
    
    Open "C:\TempInternetFile.htm" for output as #1
    'creates a htm file on your pc
    print #1, strbody
    Close #1
    
    Send Mail with ASPMail here ...
    
    Kill "C:\TempInternetFile.htm"
    I used Outlook when I did this, so for the sending / attaching part you're after this I can't help with ...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry

    Thanks Alex,

    I know that this code works in VB, but does it work in ASP.


    Code:
    <%
    
    strbody = "<html>" 
    strbody = strbody & "<body>" 
    strbody = strbody & "<p>Testing, testing 123</p>" 
    strbody = strbody & "</body>" 
    strbody = strbody & "</html>" 
    
    Open "C:\TempInternetFile.htm" for output as #1 
    'creates a htm file on your pc 
    print #1, strbody 
    Close #1 
    
    Send Mail with ASPMail here ... 
    
    Kill "C:\TempInternetFile.htm" 
    
    
    %>

    I get this error...

    Open "C:\TempInternetFile.htm" for output as #1
    -------------------------------^

    Am I doing something wrong??

    Thanks,
    T

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    It works in vbs, but have just tried in asp & can't for the life of me figure why this is the case.

    Take a look at the FileSystemObject as a workaround as you can create text files and write to them via this.

    Bloody confusing though !

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry

    Thanks, I'll try and figure it out.

    T

  6. #6
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    the 2 methods you're gonna need to look at are :
    Code:
    Dim Fso As New FileSystemObject
    
    Fso.CreateTextFile "C:\TempInternetFile.htm"
    Fso.OpenTextFile "C:\TempInternetFile.htm"
    Take a look at this page for more help : http://msdn.microsoft.com/scripting/...gwithfiles.htm

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

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



Click Here to Expand Forum to Full Width