Solved

Open Outlook to compose and e-mail

Posted on 2011-03-09
9
730 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 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