Open outlook in Asp.net(C#) only in 3 steps-:
Step 1 : At
first add the namespace for outlook and if its not showing in intellisense than
add reference for Microsoft.Outlook
using
Microsoft.Office.Interop.Outlook;
Step 2 : Bind Data in Grid Which contains Mail Address.Keep
Mail Id in Template field in this format
<asp:TemplateField HeaderText="Email"
SortExpression="Email">
<ItemTemplate>
<asp:LinkButton ID="lbSendMail"
runat="server" CommandName="SendMail"
CommandArgument='<%# Bind("Email") %>' Text='<%#
Bind("Email") %>' ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
Step 3 : Fire the RowCommand Event of GridView
and Write down the Code Given Below.
if
(e.CommandName == "SendMail")
{
Microsoft.Office.Interop.Outlook.Application
oApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem oMailItem =
(Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(OlItemType.olMailItem);
oMailItem.To =
e.CommandArgument.ToString();
//Similary U can Add another Detail like body, bcc etc...
oMailItem.Display(true);
}
Now Run Your Programme and output will be like
this :
Note : To get proper output you have to configure Outlook in your System.
And Finally Here is the Source Code :
And Finally Here is the Source Code :
i get the fellowing message
ReplyDeleteCLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
Outlook style customization in C#.NET
ReplyDeleteHi
ReplyDeleteI have the same problem as melaouhia mohamed amine.
Getting this message in IIS when trying to browse may page.
IIS dont have access rights to Outlook... any ideas...
You have to give permission in Webconfig ,set impersonate to true . but it will only run in local IIS Not in Server to Client side
DeleteYour blog was really nice and helpful, I think this is one of the best customer support review that is you provided to us. For any technical support call at 0800-090-3220 or visit Outlook Helpline Number UK
ReplyDeletei get the fellowing message
ReplyDeleteCLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).