Solved

Open Outlook to compose and e-mail

Posted on 2011-03-09
9
726 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:ITMikeK
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

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

Expert Comment

by:deadlyDev
Comment Utility
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
Comment Utility
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
Comment Utility
This is a solution, but perfoming the task in C# was the way to go.
0
 
LVL 7

Expert Comment

by:deadlyDev
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now