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

时间:2022-08-14 18:15:00

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.

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

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.

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

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.

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

12 个解决方案

#1


27  

You can do it in Eudora.

你可以在Eudora做到。

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

您可以使用自定义窗体在Outlook中以编程方式执行此操作。

You can do it in Mozilla from about:config.

你可以从about:config在Mozilla中完成。

#2


20  

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.

虽然它不是最严格意义上的插件,但您可以创建一个代理SMTP服务器来修改电子邮件 - 例如比如AVG Outgoing E-mail Scanner。这将具有与许多电子邮件客户端合作的优势;你也可以制作一个插件,它可以与一方的代理进行通信,另一方面可以与电子邮件用户界面进行通信。

#3


5  

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

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

#4


5  

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

我同意Piskvor的观点。我会将其实现为代理SMTP服务器,这将产生许多好处:

  1. You'd not be constrained to any one email client and therefore limited by its APIs (if any)
  2. 您不会受限于任何一个电子邮件客户端,因此受其API(如果有)的限制

  3. It can be applied on the mail server end, therefore installation and deployment headaches are eliminated
  4. 它可以应用于邮件服务器端,因此消除了安装和部署难题

#5


4  

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).

Emacs可以通过编程方式执行此操作。您可以创建一个缓冲区(get-buffer-create),用头信息填充它,并调用mail-send non interactivelly(将mail-interactive设置为nil)。

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

用于mail-send的缓冲区内容(标题+正文)的示例:

From: "Toto" <toto@toto.net>
To: somebody@somewhere.net
Subject: Something
BCC: sebastien.rocca-serra@f4-group.com
--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.

您还可以通过向mail-send-hook添加挂钩来更改每个传出电子邮件(标题+正文)。

#6


3  

This has already been asked specifically about Thunderbird:

已经有人特别询问过Thunderbird:

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

最上面的答案包含修改普通xul / js中标题的代码。

#7


2  

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.

我认为这种方法是去配置SENDMAIL并通过[bash / etc]脚本来做,如果我理解正确的话。

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

根文件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/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行定义。这一行的语法是

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

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.

本规范中的延续行直接插入到外发消息中。在将htemplate插入到消息中之前,它是宏扩展的。如果扩展为空,则不包括标题行。如果指定了mflags(由问号包围),则必须在邮件程序定义中指定至少一个指定的标志,以便自动输出此标头。如果其中一个标头位于输入中,则无论这些标志如何,都会将其定向到输出。

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:

特殊标题行几个标题行具有由配置文件定义的特殊解释。其他人对sendmail内置的解释在不更改代码的情况下无法更改。以下列表中描述了内置功能:

• 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.

•Return-Receipt-To:如果发送此标头,则在最终传送完成时将向任何指定的名称发送一条消息。邮件程序必须在邮件程序描述符中设置l标志(本地传递)。 •错误 - 收件人:如果在处理过程中发生错误,则此标头会将错误消息发送到列出的名称而不是发件人。将此标题行用于邮件列表,以便将错误返回给列表管理员。 •收件人:如果邮件中没有列出收件人(在收件人:,CC:或BCC:行中),则sendmail会为sendmail命令行上指定的每个收件人添加一个“显然收件人:”标题行。

#8


1  

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.

我发现,因为pine是开源的,如果这个功能对你来说对这个程序很重要,你可以尝试为项目添加功能。

#9


1  

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.

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

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

我通过在Debian BTS系统中的使用了解了伪标题。

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.

回答这个问题,我使用GMail,你不能以编程方式编辑标题(我有兴趣看到一个可以让你的网页邮件)。你甚至无法过滤像X-List这样的自定义标题,这很烦人。

#10


1  

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.

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

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.

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

#11


1  

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.

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

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

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

#12


0  

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.

对于支持使用外部编辑器的所有邮件客户端,您可以使用一个脚本,将特定标头添加到发送给编辑器的模板中。在mutt中,有一个名为edit_headers的配置参数,它添加了一组通用标题,因此很容易添加自己的标题。还有另一个名为my_hdr的参数可以使用。 Mutt确实支持`backtick`符号来运行外部命令。

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

能够指定一个人自己的模板会更好,但还不可能。

#1


27  

You can do it in Eudora.

你可以在Eudora做到。

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

您可以使用自定义窗体在Outlook中以编程方式执行此操作。

You can do it in Mozilla from about:config.

你可以从about:config在Mozilla中完成。

#2


20  

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.

虽然它不是最严格意义上的插件,但您可以创建一个代理SMTP服务器来修改电子邮件 - 例如比如AVG Outgoing E-mail Scanner。这将具有与许多电子邮件客户端合作的优势;你也可以制作一个插件,它可以与一方的代理进行通信,另一方面可以与电子邮件用户界面进行通信。

#3


5  

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

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

#4


5  

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

我同意Piskvor的观点。我会将其实现为代理SMTP服务器,这将产生许多好处:

  1. You'd not be constrained to any one email client and therefore limited by its APIs (if any)
  2. 您不会受限于任何一个电子邮件客户端,因此受其API(如果有)的限制

  3. It can be applied on the mail server end, therefore installation and deployment headaches are eliminated
  4. 它可以应用于邮件服务器端,因此消除了安装和部署难题

#5


4  

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).

Emacs可以通过编程方式执行此操作。您可以创建一个缓冲区(get-buffer-create),用头信息填充它,并调用mail-send non interactivelly(将mail-interactive设置为nil)。

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

用于mail-send的缓冲区内容(标题+正文)的示例:

From: "Toto" <toto@toto.net>
To: somebody@somewhere.net
Subject: Something
BCC: sebastien.rocca-serra@f4-group.com
--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.

您还可以通过向mail-send-hook添加挂钩来更改每个传出电子邮件(标题+正文)。

#6


3  

This has already been asked specifically about Thunderbird:

已经有人特别询问过Thunderbird:

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

最上面的答案包含修改普通xul / js中标题的代码。

#7


2  

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.

我认为这种方法是去配置SENDMAIL并通过[bash / etc]脚本来做,如果我理解正确的话。

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

根文件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/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行定义。这一行的语法是

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

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.

本规范中的延续行直接插入到外发消息中。在将htemplate插入到消息中之前,它是宏扩展的。如果扩展为空,则不包括标题行。如果指定了mflags(由问号包围),则必须在邮件程序定义中指定至少一个指定的标志,以便自动输出此标头。如果其中一个标头位于输入中,则无论这些标志如何,都会将其定向到输出。

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:

特殊标题行几个标题行具有由配置文件定义的特殊解释。其他人对sendmail内置的解释在不更改代码的情况下无法更改。以下列表中描述了内置功能:

• 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.

•Return-Receipt-To:如果发送此标头,则在最终传送完成时将向任何指定的名称发送一条消息。邮件程序必须在邮件程序描述符中设置l标志(本地传递)。 •错误 - 收件人:如果在处理过程中发生错误,则此标头会将错误消息发送到列出的名称而不是发件人。将此标题行用于邮件列表,以便将错误返回给列表管理员。 •收件人:如果邮件中没有列出收件人(在收件人:,CC:或BCC:行中),则sendmail会为sendmail命令行上指定的每个收件人添加一个“显然收件人:”标题行。

#8


1  

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.

我发现,因为pine是开源的,如果这个功能对你来说对这个程序很重要,你可以尝试为项目添加功能。

#9


1  

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.

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

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

我通过在Debian BTS系统中的使用了解了伪标题。

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.

回答这个问题,我使用GMail,你不能以编程方式编辑标题(我有兴趣看到一个可以让你的网页邮件)。你甚至无法过滤像X-List这样的自定义标题,这很烦人。

#10


1  

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.

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

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.

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

#11


1  

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.

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

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

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

#12


0  

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.

对于支持使用外部编辑器的所有邮件客户端,您可以使用一个脚本,将特定标头添加到发送给编辑器的模板中。在mutt中,有一个名为edit_headers的配置参数,它添加了一组通用标题,因此很容易添加自己的标题。还有另一个名为my_hdr的参数可以使用。 Mutt确实支持`backtick`符号来运行外部命令。

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

能够指定一个人自己的模板会更好,但还不可能。