Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi
I want to open default mail client using C#.Can any one help me to do this.

Thanks
Posted
Comments
Suresh Suthar 18-Aug-11 2:36am    
Not clear.
But you can use mailto:mail@domain.com link in asp.net or you can start process in windows application with passing mailto:mail@domain.com.

Use hyperlink in Asp.Net
ASP.NET
<asp:HyperLink
            ID="HyperLink1"
            runat="server"
            Text="Send E mail"
            NavigateUrl="mailto:mail@domain.com"
            >


Or use this in windows based application.
C#
System.Diagnostics.Process.Start("mailto:mail@domain.com");
 
Share this answer
 
Comments
Dalek Dave 18-Aug-11 4:08am    
Good Answer.
nandakishoreroyal 19-Sep-14 3:30am    
what i want to do if i need html content in body??

Please help. Urgent
Shivam Sharma 28-Jun-17 9:31am    
can append Body like
System.Diagnostics.Process.Start("mailto:name@domain.com?body=Message goes here!!");
Hi If you want to use link then you can use following syntax,

C#
<asp:hyperlink id="hlnkSendMail" runat="server" navigateurl="mailto:user@example.com?cc=user@example.com&bcc=user@example.com&subject=MessageTitle&body=Message Content" target="_blank" text="Send Mail Link" xmlns:asp="#unknown"></asp:hyperlink>


And, if you are require to use button you can use following syntax

C#
<asp:button id="btnSendMailClient" runat="server" onclientclick="return OpenMailWindow();" text="Send Mail" xmlns:asp="#unknown" />


Add following javascript function also,

JavaScript
function OpenMailWindow()
        {
            window.open("mailto:user@example.com?cc=user@example.com&bcc=user@example.com&subject=MessageTitle&body=Message Content");
            return false;
        }
 
Share this answer
 
Comments
Dalek Dave 18-Aug-11 4:08am    
Nice.
Praveen Meghwal 18-Aug-11 4:17am    
Thanks Dalek

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900