Send excel report as mail attachment RRS feed

  • Question

  • User491112072 posted
    Hi I've a report and it has got an option to send it as mail attachment. For this what I've done is provided a MAIL link on the page, on clicking this I'm opening a pop up window and allowing user to enter the Email address to which they want to send the report and once he clicks on the SEND button mail is sent with attachment and the pop up window vanishes. But the attachment is a excel file with a graph (.png) file inserted in it. So when the user clicks on the MAIL link, I am generating the graph, opening Excel COM object, inserting the image into it and then creating a file (temporarily) and then sending the mail (deleting the file created) Can anyone please tell me a better solution for this. Since in the current solution, I am using the COM which is leaving the excel reference on the server and sometimes I'm getting the "The instruction at '0x3006ib44' referenced memory at '0x050c0481'. The memory could not be read. Click ok to terminate. Click cancel to debug" error on the server. Thanks in advance Srinivas
    Thursday, November 20, 2003 8:20 PM

All replies

  • User-1144360457 posted
    Try to use Cdonts (CDO.SYS) shipped With the installation of VB6.
    Saturday, November 22, 2003 12:29 PM
  • User491112072 posted
    Hi, The problem is not for sending the mail, but to generate the excel sheet and inset a graph image into it effectively. ASP.NET by default has got MAIL class and I'm using the same. But the thing is, when I tried the same appln in VB.Net application it worked fine and there is no trace of EXCEL after using the MARSHAL class. I need to do the same in web application, where it's not working. Srinivas
    Saturday, November 22, 2003 4:25 PM
  • User-1144360457 posted
    Yes, Sorry not to have grasped the problem at once. I think that you are aware as me that using com & .Net fram togheter is not a good thing. Depending on the complexity of the graph you are producing I 'd leave com and excell for production. Why don't build an user control and show the graph directly on the page? Your customer can save the image and help using other software. I am in the mood to develop in a way that people can have full visibility by only using the browser. Thay in my opinion is the spirit of the NET.Framework. Before to give up look at the 1.1 version of the framework on a Windows 2003 server Ent. With the last updates. nice developing
    Sunday, November 23, 2003 2:56 PM
  • User-1221795426 posted

    hi Y.Srinivas 

    here is you compelete solution.

    Code is here 

    In this code you can send any file you have to give your smtp, email and password then it works.

    if any query then feel free to ask me. i'll try my best

    Thursday, August 11, 2011 1:19 AM
  • User1875685905 posted

    Thanks! Your'e a lifesaver.

    Sunday, August 28, 2011 10:29 AM