Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Open Outlook to compose and e-mail

Posted on 2011-03-09
9
734 Views
Last Modified: 2013-12-17
I have a ASP.NET3.5 Web App with c# code.
When the user clicks a button that performs an Insert with a certian field "checked" I would like to automatically open Outlook 2007 (on the workstation) to compose an e-mail with the recipients and a default text already filled in for sending.
I have read about a couple of ways to do this....I am looking for more feedback as to what is the "best" way.
0
Comment
Question by:ITMikeK
  • 5
  • 4
9 Comments
 
LVL 7

Accepted Solution

by:
deadlyDev earned 500 total points
ID: 35087362
Have a look at this site http://www.ianr.unl.edu/internet/mailto.html It deals with all your requirements :)
0
 

Author Comment

by:ITMikeK
ID: 35087760
DeadlyDev,
How would I link this to a control....say a checkbox in a template field of a DetailsView?
0
 
LVL 7

Expert Comment

by:deadlyDev
ID: 35088050
I would suggest using JavaScript.... its a bit difficult exactly how without having a look at the html source of the page.... Can you provide a link, or attach the file, and I'll throw something together for you...
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

Author Comment

by:ITMikeK
ID: 35088334
DD,
The item I want this to work with is "Checkbox1" that binds "Status". It is a template field.
Thanks
<asp:BoundField DataField="TranDt" HeaderText="TranDt" 
                SortExpression="TranDt" Visible="False" />
            <asp:BoundField DataField="Weight" HeaderText="Weight" 
                SortExpression="Weight" />
            <asp:TemplateField HeaderText="Coil on hold" 
                SortExpression="Status">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Status") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Status") %>' />
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="FinishedGood" SortExpression="FinishedGood">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("FinishedGood") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" 
                        Checked='<%# Bind("FinishedGood") %>' />
                </InsertItemTemplate>
                <ItemTemplate>

Open in new window

0
 

Author Comment

by:ITMikeK
ID: 35088447
I may have to do this in the code behind instead.......
0
 
LVL 7

Expert Comment

by:deadlyDev
ID: 35088520
Thats fine... I will have a look at this tomorrow morning for you... am a bit tired :P shouldn't take long :)
0
 

Author Comment

by:ITMikeK
ID: 35090113
This code worked for me....
var outlookApplication = new Microsoft.Office.Interop.Outlook.Application();
            // Create mail message. 
            var newMail = (Microsoft.Office.Interop.Outlook.MailItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
            newMail.To = "mike@rocksidetechnology.com";
            newMail.Subject = "Coil On Hold at Cleaning House";
            newMail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
            newMail.HTMLBody = "<p>Bernie and Brad,</p><p>There is a Coil that has been placed on hold at the Cleaning House Workstation.</p><p>The Coil number is - ";
            newMail.Display(false);

Open in new window

0
 

Author Closing Comment

by:ITMikeK
ID: 35090128
This is a solution, but perfoming the task in C# was the way to go.
0
 
LVL 7

Expert Comment

by:deadlyDev
ID: 35093243
Glad to see you found a solution. Now that I see your full intention, you certainly have the best solution to the problem!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question