如何使用C#打开默认邮件客户端 [英] how to open default mail client using c#

查看:65
本文介绍了如何使用C#打开默认邮件客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想使用C#打开默认邮件客户端.任何人都可以帮助我做到这一点.

谢谢

Hi
I want to open default mail client using C#.Can any one help me to do this.

Thanks

推荐答案

在Asp.Net中使用超链接
Use hyperlink in Asp.Net
<asp:HyperLink

            ID="HyperLink1"

            runat="server"

            Text="Send E mail"

            NavigateUrl="mailto:mail@domain.com"

            >



或在基于Windows的应用程序中使用它.



Or use this in windows based application.

System.Diagnostics.Process.Start("mailto:mail@domain.com");


嗨 如果要使用链接,则可以使用以下语法,

Hi If you want to use link then you can use following syntax,

<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

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



还添加以下javascript函数,



Add following javascript function also,

function OpenMailWindow()
        {
            window.open("mailto:user@example.com?cc=user@example.com&bcc=user@example.com&subject=MessageTitle&body=Message Content");
            return false;
        }


这篇关于如何使用C#打开默认邮件客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆