open outlook email from ASP.NET page

Last post 07-18-2008 4:44 AM by BSolveIT. 10 replies.

Sort Posts:

  • open outlook email from ASP.NET page

    07-17-2008, 1:11 PM
    • Member
      30 point Member
    • ddee
    • Member since 10-03-2006, 6:34 PM
    • Posts 69
    Hi all, I hope someone can help me with this email… I am so desperate LI have a webpage in c# and asp.net… I would like to send email from outlook .When I click on a button on my webpage, it will open outlook with fill in info for send FROM CLIENT MACHine.How do I do that…. I follow some suggestion when seach on the web……         Microsoft.Office.Interop.Outlook.Application MSO = new Microsoft.Office.Interop.Outlook.Application();        //Create a new Message object        Microsoft.Office.Interop.Outlook.MailItem msg ;        //Compose the message        msg = (Microsoft.Office.Interop.Outlook.MailItem)MSO.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);        msg.Subject = "My email subject";        msg.To = “List of email”;        //Create an HTML formatted body        String body= "";        body = "<h1>This is an HTML Email</h1><p>Hello, here is a test message.</p>";        //Use this To display before sending, otherwise call objMail.Send to send without reviewing        msg.Display(true);        //Use this To display before sending, otherwise call msg.Send to send without reviewing        //Clean up        msg = null;        MSO = null; And SADLY, it is ONLY WORK  on my local debug machine… when I ported code to run on server… I got error: Server Error in '/' Application.

    Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154  Any help is greatly appreciated… Ddee

     

  • Re: open outlook email from ASP.NET page

    07-17-2008, 2:26 PM
  • Re: open outlook email from ASP.NET page

    07-17-2008, 2:55 PM
    • Member
      30 point Member
    • ddee
    • Member since 10-03-2006, 6:34 PM
    • Posts 69

    Thank you so much for your response...

    I did try as the way this link show for c#

    http://forums.devx.com/showthread.php?threadid=152716

    but unfortunelly, it is only work on my local debug web page.  When I port to and run code in the server, i got error:

    Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154.

    where the code show:

     Microsoft.Office.Interop.Outlook.Application MSO = new Microsoft.Office.Interop.Outlook.Application();

     Please..help.. anyone...


  • Re: open outlook email from ASP.NET page

    07-17-2008, 3:23 PM
    • Member
      384 point Member
    • sivi
    • Member since 04-17-2008, 2:38 PM
    • Posts 62

    Check this link:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=80283&SiteID=1

    Make sure that this COM dll is registered properly on the server.

     

    svk

    Please remember to Mark as Answer if the solution helps to fix the problem.
  • Re: open outlook email from ASP.NET page

    07-17-2008, 4:00 PM
    • Member
      30 point Member
    • ddee
    • Member since 10-03-2006, 6:34 PM
    • Posts 69

     

    HI sivi,

    Thanks again for your help..

    I try to register the com dll by do the below on the SERVER

     regsvr32  "C:\temp\Microsoft.Office.Interop.Outlook.dll"

    but i get this error:

    "C:\temp\Microsoft.Office.Interop.Outlook.dll was loaded, but the DllRegisterServer entry point was not found"

    Do you have any idea why?

    Does the server required to install the MS outlook?????

     Thank you.

     

  • Re: open outlook email from ASP.NET page

    07-17-2008, 4:18 PM
    • Member
      384 point Member
    • sivi
    • Member since 04-17-2008, 2:38 PM
    • Posts 62

    I think you have to install Outlook on the server to make it work. The interop assembly might need some other Outlook dlls, so it needs MS Outlook to be installed in the machine.

    svk

    Please remember to Mark as Answer if the solution helps to fix the problem.
  • Re: open outlook email from ASP.NET page

    07-17-2008, 8:38 PM
    • Contributor
      3,550 point Contributor
    • BSolveIT
    • Member since 05-10-2007, 10:20 PM
    • Northamptonshire, UK
    • Posts 607

    Please excuse me if I'm missing the point., but...

    You say you want to open an outlook email?  Of course, there's no such thing.  Do you mean you want to read an email from some version of MS Exchange?  Which protocol do you need to use MAPI, IMAP, POP3, etc?  What is it your actually trying to achieve? 

    Cheers,
    BSolveIT

    Website Design & Search Engine Optimisation

    SEO Frequently Asked Questions

    If you get an answer to a question, please mark it as the answer. Many thanks!
  • Re: open outlook email from ASP.NET page

    07-17-2008, 9:23 PM
    • Member
      30 point Member
    • ddee
    • Member since 10-03-2006, 6:34 PM
    • Posts 69

    HI BSolveIT,

     I would like to  run my website which have abutton.... when click on the button, it will open outlook email from the CLIENT Machine  and fill in with info for send .

    I follow some suggestion by doing the below  ... but it is only work on my local machine.

    When i run the code from the server, it failed with error

       
         Outlook.Application objOutlk = new Outlook.Application();
         //Outlook
         const int olMailItem = 0;
         object objMail = new object();
         objMail = objOutlk.CreateItem(olMailItem);
         //Email item
         objMail.To = emaila.Text;
         objMail.cc = "";
         //Enter an address here To include a carbon copy; bcc is For blind carbon copy's
         //Set up Subject Line
         objMail.subject = "Quality Assurance Letter";
         //To add an attachment, use:
         //objMail.attachments.add("C:\MyAttachmentFile.txt")
         string msg;
         msg = "body test msg";
         objMail.body = msg;
         //Use this To display before sending, otherwise call objMail.Send to send without reviewing
         objMail.display();
         //Use this To display before sending, otherwise call objMail.Send to send without reviewing
         //Clean up
         objMail = null;
         objOutlk = null;
     

    AM i doing this correct or is there anyway that you can suggest me to do... Thanks

  • Re: open outlook email from ASP.NET page

    07-17-2008, 9:35 PM
  • Re: open outlook email from ASP.NET page

    07-17-2008, 10:31 PM
    • Member
      30 point Member
    • ddee
    • Member since 10-03-2006, 6:34 PM
    • Posts 69

    Thank you all for your input.

    itsumapathyk,

    I tried exactly what you show on the link

    www.dotnetspider.com/forum/101706-How-open-Outlook-Express-Window-ASP-NET-page.aspx 

    but when i run code on the server, i got error

    Server Error in '/' Application.

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154

    -------------------------------

    There are some suggestion that i need to register the outlook dll.... Then

    I try to register the com dll by do the below on the SERVER

     regsvr32  "C:\temp\Microsoft.Office.Interop.Outlook.dll"

    but i get this error:

    "C:\temp\Microsoft.Office.Interop.Outlook.dll was loaded, but the DllRegisterServer entry point was not found"

     

    Does the server required to install the MS outlook?????

    Thank you.

  • Re: open outlook email from ASP.NET page

    07-18-2008, 4:44 AM
    Answer
    • Contributor
      3,550 point Contributor
    • BSolveIT
    • Member since 05-10-2007, 10:20 PM
    • Northamptonshire, UK
    • Posts 607

    The code you're running is attempting to open outlook on the server, thats all.  I don't think there's any way to achieve what your wanting to do on the client machine, not from a web page.  The closest you'll get to it is to specify the subject and body in the mailto link, and let the client launch it's default mail client.  There's no way you can specify an email attachment though, not on the client.

    Cheers,
    BSolveIT

    Website Design & Search Engine Optimisation

    SEO Frequently Asked Questions

    If you get an answer to a question, please mark it as the answer. Many thanks!
Page 1 of 1 (11 items)