通过 mailto 强制邮件客户端使用文本而不是 HTML:

发布于 2024-08-03 00:01:12 字数 902 浏览 3 评论 0原文

我在我正在处理的 C# 项目上使用 SubVersion 和 TRAC,并且我的 TRAC 系统设置有一个可用于创建票证的电子邮件地址。在我的程序中,我在程序中添加了一个简单的“反馈”按钮,该按钮会向该地址发送电子邮件。要打开电子邮件,我只需“启动”mailto 链接,如下所示。

System.Reflection.Assembly assem = System.Reflection.Assembly.GetExecutingAssembly();
string ver = assem.GetName().Version.ToString();
System.Diagnostics.Process.Start("mailto:[email protected]?subject=<Provide a title for your feedback here>&body=< Describe the problem you are having or enhancement you would like to suggest here. Please be as descriptive as you can, and if possible list out the actions that will replicate the problem >%0D%0A%0D%0A%0D%0AVersion: "+ver); 

我遇到的问题是,如果用户使用 Outlook 并且他们的 Outlook 副本设置为 HTML,则创建的票证最终会包含一堆我必须清理的 HTML 代码。有没有某种方法可以通知正在处理的任何邮件客户端以文本而不是 HTML 形式发送电子邮件?

I'm using SubVersion and TRAC on a C# project I am working on, and I have my TRAC system setup with a email address that can be used to create tickets. In my program I've added a simple "FeedBack" button in my program which sends an email to this address. To open the email I'm just "starting" a mailto link as shown below.

System.Reflection.Assembly assem = System.Reflection.Assembly.GetExecutingAssembly();
string ver = assem.GetName().Version.ToString();
System.Diagnostics.Process.Start("mailto:[email protected]?subject=<Provide a title for your feedback here>&body=< Describe the problem you are having or enhancement you would like to suggest here. Please be as descriptive as you can, and if possible list out the actions that will replicate the problem >%0D%0A%0D%0A%0D%0AVersion: "+ver); 

The problem I'm running into is if the user is using Outlook and their copy of Outlook is setup to HTML the ticket that gets created ends up having a bunch of HTML code that I have to clean up. Is there some way to notify whatever mail client is handling it to send the email as text rather then HTML?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叹梦 2024-08-10 00:01:12

您在客户端上无能为力(除了教育) - mailto 中没有任何内容控制客户端程序。而且,坦率地说,随着基于网络的电子邮件的激增 - 我认为 mailto 正在显示它的时代。

Outlook 应发送 mime/multipart 消息,包含纯文本和 HTML 部分。我猜你可以扩展或修补 Trac 以仅获取 text/plain 部分。

否则,只需在您的应用程序中创建一个表单来捕获电子邮件信息。再说一次,如果有人使用 Hotmail 或 GMail - mailto 无论如何都不太可能工作(或者会打开他们未配置的 Outlook Express,他们会尽职尽责地键入电子邮件并按“发送”。只是它不会发送到任何地方,因为没有 SMTP服务器已配置 - 所以它会在发件箱中滞留多年,但他们不会注意到......)。

There's nothing you can do (besides education) on the client - there's nothing in mailto to control a client side program. And, frankly, with the proliferation of web-based email - I think mailto is showing it's age.

Outlook should send a mime/multipart message, with both plain text and HTML parts. I'd guess you could extend or patch Trac to only grab the text/plain portion.

Otherwise, just create a form in your app to capture the email info. Again, if someone is using Hotmail or GMail - mailto is not likely to work anyway (or will open up their unconfigured Outlook Express, where they will dutifully type up an email and press Send. Only it won't go anywhere, because no SMTP servers are configured - so it will languish in the Outbox for years. Not that they will notice though...).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文