DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Opening Outlook from Asp.net

  1. #1
    Join Date
    Jun 2004
    Location
    Saudi Arabia
    Posts
    63

    Talking Opening Outlook from Asp.net

    Hi friends,
    I am in need to open ms-outlook from asp.net application can anybody help me in this can you send the code and the address of the receipent should come in the To option of the outlook application

    regards,
    Jabbar

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    ASP.NET code runs on the Web server. If you open Outlook from ASP.NET, it will open on the Web server, not on the user's computer. Is that what you want?

    If you want the user to click a link and have an e-mail open with a specific address in the To field, you can simply use a mailto link:

    <a href="mailto:address@domain.com">Click here to send an e-mail</a>
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jun 2004
    Location
    Saudi Arabia
    Posts
    63

    Talking

    thanks for the reply,
    now i am in need to give email address from my application
    to the outlook form so instead of <a href="mailto:address@domain.com"> what shall i write to get address instead of address@domain.com to my supplied address also i need to put automatically cc,bc and subject from my application to the outlook form

    regards jabbar

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Jul 2006
    Posts
    1

    this is how i do it

    this should spawn on the client machine not the web server. but then again im using an all in one so ....
    dont forget to import the outlook namespace at the top of your codebehind page

    Imports outlook

    Dim objOutlk As New Outlook.Application 'Outlook
    Const olMailItem As Integer = 0
    Dim objMail As New System.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")
    dim msg as string
    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 = Nothing
    objOutlk = Nothing

    hope this helps
    dan
    dkandersack@hotmail.com
    Last edited by dkandersack; 07-23-2006 at 09:41 PM. Reason: added imports

  6. #6
    Join Date
    May 2008
    Posts
    2

    Smile Issue with the OUTLOOK Code in C#

    Hi,

    I have used the code which you have posted in VB.NET in C# ,iam getting following Errors.

    Error 40 'object' does not contain a definition for 'To' E:\WWT\Example\OurlookMail.aspx.cs 34 21 E:\WWT\
    Error 41 'object' does not contain a definition for 'cc' E:\WWT\Example\OurlookMail.aspx.cs 35 21 E:\WWT\
    Error 42 'object' does not contain a definition for 'subject' E:\WWT\Example\OurlookMail.aspx.cs 38 21 E:\WWT\
    Error 43 'object' does not contain a definition for 'body' E:\WWT\Example\OurlookMail.aspx.cs 43 21 E:\WWT\
    Error 44 'object' does not contain a definition for 'display' E:\WWT\Example\OurlookMail.aspx.cs 45 21 E:\WWT\

    Here is My C# Code:
    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;


    Please reply me the action which i need to take.

    Thanks in Advance...


    Vijay

  7. #7
    Join Date
    May 2008
    Location
    Chicago, IL
    Posts
    64
    vb.net to c#
    Code:
     {
        
        
         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;
     }
    http://labs.developerfusion.co.uk/co...to-csharp.aspx

    although Refractor 2.0 does the same thing
    David CodeGuru Article: Bound Controls are Evil-VB6

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    May 2008
    Posts
    2

    Smile Issue with the OUTLOOK Code in C#

    Hi,
    Thanks for your Reply,i already used same code as below,

    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;


    but iam getting same errors as below,

    objMail.To ==> objMail Dosen't Contain a Definition for "To" and "Cc" and all

    is just contains "Equals", "GetHashCode","GetType","ToString".

    Please Suggest me,but it is perfectly executed in VB.NET.

    Thanks In Advance...

    Vijay

Similar Threads

  1. Replies: 4
    Last Post: 02-20-2007, 09:09 AM
  2. Outlook 2003 + ASP.NET
    By Peace2u in forum ASP.NET
    Replies: 0
    Last Post: 03-05-2006, 10:02 AM
  3. Opening a blank Infopath form from ASP.NET
    By vikramjparekh in forum ASP.NET
    Replies: 2
    Last Post: 07-24-2005, 10:21 PM
  4. Free ASP.NET Web Matrix Design/Editor Tool Released
    By ASPSmith Training in forum dotnet.announcements
    Replies: 0
    Last Post: 06-18-2002, 03:39 AM
  5. Opening other mailboxes in Outlook
    By Gil in forum Enterprise
    Replies: 0
    Last Post: 02-28-2002, 12:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center