您的电子邮件客户端是否允许您以编程方式添加自定义标头?

发布于 2024-07-08 16:22:27 字数 453 浏览 8 评论 0原文

我正在开发一个反垃圾邮件项目(centmail),该项目涉及让发件人使用添加自定义的客户端插件标头(以及签名,但这部分更简单)。 一般问题是向外发邮件添加电子邮件标头,其中标头字段的内容是为每封邮件动态确定的。

令人惊讶的是,这在 Pine/Alpine 中似乎不可能。 Pine 允许您为外发邮件指定过滤器脚本,但只有正文而不是标头可以通过它。 您当然可以在 Pine 设置中定义自定义标头,但我认为没有办法动态更改它们的内容。

我很高兴听到如何在其他电子邮件客户端(Thunderbird、Outlook、Evolution、Mutt 等)中执行此操作。 当然,如果我对 Pine 的看法是错误的。

I'm working on an anti-spam project (centmail) that involves having the sender use a client plugin that adds a custom header (as well as a signature, but that part's easier). The general problem is to add an email header to your outgoing mail where the contents of the header field is determined dynamically for each message.

Surprisingly, this does not seem to be possible in Pine/Alpine. Pine lets you specify a filter script for outgoing mail but only the body and not the headers get passed through it. You can of course define custom headers in the Pine settings but I see no way to dynamically change the contents of them.

I'd be grateful to hear how to do this in other email clients (Thunderbird, Outlook, Evolution, Mutt, etc). And of course if I'm wrong about Pine.

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

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

发布评论

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

评论(12

娇女薄笑 2024-07-15 16:22:27

您可以在 Eudora 中执行此操作。

您可以在 Outlook 中使用 自定义表单

您可以在 Mozilla 的 about:config 中执行此操作。

You can do it in Eudora.

You can do it programmatically in Outlook with a custom form.

You can do it in Mozilla from about:config.

沉睡月亮 2024-07-15 16:22:27

虽然它不是严格意义上的插件,但您可以创建一个代理 SMTP 服务器来修改电子邮件 - 例如 AVG 外发电子邮件扫描程序之类的东西。 这将具有与许多电子邮件客户端合作的优势; 您还可以制作一个插件,一侧与代理通信,另一侧与电子邮件 UI 通信。

Although it's not a plugin in the strictest sense, you could make a proxy SMTP server which would modify the e-mails - e.g. something like the AVG Outgoing E-mail Scanner. This would have the advantage of working with many e-mail clients; you could also make a plug-in which would communicate with the proxy on one side and the e-mail UI on the other.

余罪 2024-07-15 16:22:27

Thunderbird 插件 Enigmail 控制外发邮件的标头。 所以这是一个存在证明,证明它在 Thunderbird 中是可能的。

The Thunderbird plugin Enigmail controls the headers for outgoing mail. So that's an existence proof that it's possible in Thunderbird.

最初的梦 2024-07-15 16:22:27

我同意皮斯克沃尔的观点。 我会将其实现为代理 SMTP 服务器,这将带来许多好处:

  1. 您不会受限于任何一个电子邮件客户端,因此受到其 API(如果有)的限制
  2. 它可以应用于邮件服务器端,因此安装并且消除了部署难题

I agree with Piskvor. I would implement it as a proxy SMTP server which would yield a number of benefits:

  1. You'd not be constrained to any one email client and therefore limited by its APIs (if any)
  2. It can be applied on the mail server end, therefore installation and deployment headaches are eliminated
小…红帽 2024-07-15 16:22:27

Emacs 可以通过编程来完成此操作。 您可以创建一个缓冲区(get-buffer-create),用标头信息填充它,然后以非交互方式调用mail-send(设置mail-interactive)代码> 到 nil)。

mail-send一起使用的缓冲区内容(标头+正文)示例:

From: "Toto" <[email protected]>
To: [email protected]
Subject: Something
BCC: [email protected]
--text follows this line--

Hello, how are you?

您还可以通过向mail-send-hook添加挂钩来更改每封外发电子邮件(标头+正文)代码>.

Emacs can do this programmatically. You can create a buffer (get-buffer-create), fill it with header information, and call mail-send non interactivelly (set mail-interactive to nil).

Example of buffer content (header+body) to use with mail-send:

From: "Toto" <[email protected]>
To: [email protected]
Subject: Something
BCC: [email protected]
--text follows this line--

Hello, how are you?

You can also alter every outgoing email (header + body) by adding a hook to mail-send-hook.

我做我的改变 2024-07-15 16:22:27

已经专门询问了有关 Thunderbird 的问题:

最上面的答案包含修改纯 xul/js 中标头的代码。

This has already been asked specifically about Thunderbird:

The top answer contains the code to modify the headers in plain xul/js.

清风夜微凉 2024-07-15 16:22:27

我从 Brainunes 的旧部分中挖掘出这个内容...

我认为这种方法是去配置 SENDMAIL 并通过 [bash/etc] 脚本执行如果我理解正确

根文件
http://snap.nlc.dcccd.edu/reference/sysadmin/ julian/ewtoc.html

SendMail 配置

标头声明
http://snap.nlc.dcccd。 edu/reference/sysadmin/julian/ch04/061-064.html#Heading22

http://snap.nlc.dcccd.edu/reference/sysadmin/julian/ch04/078-080.html

标题行的格式为
由H线定义。 语法为
这行是

H[c ?c mflagsc ?]c hnamec :c htemplate

此中的延续行
直接插入规格
到传出消息中。 这
htemplate 在它之前进行了宏扩展
被插入到消息中。 如果
扩展为空,标题行为
不包含。 如果 mflags
(被问号包围)是
指定,至少其中之一
指定的标志必须在
邮件程序将此标头定义为
即可自动输出。 如果其中之一
这些标头位于输入中,它是
定向到输出,无论
这些标志。

特殊标题行 几个标题
线条有特殊的解释
由配置文件定义。
其他人有内置的解释
无法更改的sendmail
无需更改代码。 这
内置功能描述于
以下列表:

• Return-Receipt-To:如果此标头
发送后,一条消息将发送至任何
最终确定时指定的名称
交货完成。 邮寄者必须
设置 l 标志(本地交付)
在邮件描述符中。 •
Errors-To:如果任何地方发生错误
在处理过程中,该标头发送
向列出的名称发送错误消息
而不是发送给发件人。 用这个
邮件列表的标题行,以便
错误将返回到列表中
行政人员。 • 收件人:如果有消息
进来时没有列出收件人
消息(以“收件人:”、“抄送:”或“密件抄送:”形式)
行),sendmail 添加了一个显然是:
每个收件人的标题行
在 sendmail 命令上指定
线。

I dug this from the old parts of Brain tunes to other things...

I think that approach is to go to config SENDMAIL and do via [bash/etc] scripting if i understand correctly.

Root file
http://snap.nlc.dcccd.edu/reference/sysadmin/julian/ewtoc.html

SendMail Configuration

Header Declarations
http://snap.nlc.dcccd.edu/reference/sysadmin/julian/ch04/061-064.html#Heading22

http://snap.nlc.dcccd.edu/reference/sysadmin/julian/ch04/078-080.html

The format of the header lines is
defined by the H line. The syntax of
this line is

H[c ?c mflagsc ?]c hnamec :c htemplate

Continuation lines in this
specification are inserted directly
into the outgoing message. The
htemplate is macro-expanded before it
is inserted into the message. If the
expansion is empty, the header line is
not included. If the mflags
(surrounded by question marks) are
specified, at least one of the
specified flags must be stated in the
mailer definition for this header to
be automatically output. If one of
these headers is in the input, it is
directed to the output regardless of
these flags.

Special Header Lines Several header
lines have special interpretations
defined by the configuration file.
Others have interpretations built into
sendmail that cannot be changed
without changing the code. The
built-in features are described in the
following list:

• Return-Receipt-To: If this header
is sent, a message will be sent to any
specified names when the final
delivery is complete. The mailer must
have the l flag (local delivery) set
in the mailer descriptor. •
Errors-To: If errors occur anywhere
during processing, this header sends
error messages to the listed names
rather than to the sender. Use this
header line for mailing lists so that
errors are returned to the list
administrator. • To: If a message
comes in with no recipients listed in
the message (in a To:, CC:, or BCC:
line), sendmail adds an Apparently To:
header line for each recipient
specified on the sendmail command
line.

东京女 2024-07-15 16:22:27

我想到,由于 pine 是开源的,如果这个功能对您来说对于这个程序很重要,您可以尝试为该项目做出贡献以添加该功能。

It occurs to me that since pine is open source, if this functionality is important to you for this program you could try contributing to the project to add the feature.

ぃ双果 2024-07-15 16:22:27

您可能想要研究的一件事是使用伪标头而不是标头。 因为 pine/alpine 让您指定电子邮件要经过的过滤程序,所以您可以在开头将标头添加到正文中,这应该很容易处理。 我不确定它是否完全符合您的目的,因为我不知道您要组合什么类型的系统。

我通过在 Debian BTS 系统 中使用伪标头了解了它们。

回答这个问题,我使用 GMail,并且您无法以编程方式编辑标头(我有兴趣看到可以让您编辑的网络邮件)。 您甚至无法过滤像X-List这样的自定义标头,这非常烦人。

One thing that you might want to look into is using pseudo-headers instead of headers. Becasue pine/alpine let you specify a filter program for the email to go through, you can add the header to the body at the beginning, which should be easy enough to process. I'm not sure if it would fit your purposes exactly though since I do not know what type of system you are putting together.

I learned about pseudo-headers through their use in the Debian BTS System.

Answering the question, I use GMail, and you can't edit the headers programmatically (I would be interested to see a webmail that lets you). You can't even filter on custom headers like X-List, it's quite annoying.

ぶ宁プ宁ぶ 2024-07-15 16:22:27

将邮件客户端插入自定义标头的一般想法有问题。

那里有很多客户。 包括不同的版本、不同的系统。

header+body 格式背后的好处是所有非用户、服务器和路由特定数据对用户隐藏。 遵循这个想法很重要。 我认为用户不应该被一些自定义的、服务器相关的标头所困扰。

此外,您尝试附加的数据实际上是用户特定的数据。
就像签名一样。 它验证发送者的有效性。 没有理由向用户隐藏它。

电子邮件数据的签名是众所周知的过程,由 PGP、SMIME 等使用。可能有更多的邮件客户端允许此类操作(通过外部程序验证和签名),而不是允许添加或修改自定义邮件标头。

自定义标头应由邮件服务器修改; 邮件客户端的用户数据。

我认为你应该把你的数据放在消息或消息部分。

Something is wrong with general idea to plug mail clients for custom headers.

There is just to many clients out there. Including different versions, on different systems.

Good thing behind header+body format is that all non-user, server and routing specific data is hidden from the user. And that idea is important to follow. I don't think that user should be bothered with some custom, server related headers.

Also, the data that you are trying to append is, in fact, user specific data.
Like signature. It verifies validity of sender. There is no reason to hide it from user.

Signing of email data is well-known process, used by PGP, SMIME, etc. There is probably more mail clients allowing such actions (verify and sign by external programs) than allowing to add or modify custom mail headers.

Custom headers should be modified by mail servers; user data by mail clients.

I think that you sholud put your data in message or message part.

一绘本一梦想 2024-07-15 16:22:27

使其在 pine 中工作而不修改 pine 本身或修改邮件服务器的一种方法是让 pine 通过命令行程序(传统上 /usr/sbin/sendmail 等)进行传递,并让被调用的程序成为原始程序的包装器程序。 然后您可以添加您需要的任何标头。

虽然这很丑陋,但它肯定无法扩展到整个用户群。

One way to make it work in pine without modifying pine itself or modifying the mail server is to have pine deliver via a command line program (traditionally /usr/sbin/sendmail or the like) and have the called program be a wrapper for the original program. Then you can add whatever header you need.

That's ugly though, it certainly wouldn't scale for a whole user base.

泪痕残 2024-07-15 16:22:27

对于所有支持使用外部编辑器的邮件客户端,您可以使用一个脚本将特定标头添加到发送到编辑器的模板中。 在 mutt 中,有一个配置参数,名为 edit_headers 添加一组通用的标头,以便轻松添加您自己的标头。 还有另一个参数,名为 my_hdr 可以使用。 Mutt 确实支持“反引号”符号来运行外部命令。

能够指定自己的模板会更好,但目前还不可能。

For all mail clients that support using an external editor, you could have a script that add a specific header to the template that gets send to the editor. In mutt, there is a configuration parameter called edit_headers that add a common set of headers so it would be easy to add your own. There is also another parameter called my_hdr which could be used. Mutt does support the ` backtick `` notation to run external commands.

It would be better to be able to specify one's own template but it is not possible yet.

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