?
Solved

Open Outlook to compose and e-mail

Posted on 2011-03-09
9
Medium Priority
?
740 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
[X]
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
  • 5
  • 4
9 Comments
 
LVL 7

Accepted Solution

by:
deadlyDev earned 1500 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

765 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