You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Sieve Vacation脚本中如何获取原始邮件内容?

在Sieve脚本中获取原始邮件内容并实现自动回复

方法1:将邮件内容存入变量并引用

首先需要添加body扩展支持,通过body :matches规则捕获邮件文本内容到变量,之后在回复文本中直接调用该变量。修改后的完整脚本如下:

require "variables";
require "vacation";
require "body";

# 捕获邮件主题
set "subject" "";
if header :matches "subject" "*" {
   set "subject" "${1}";
}

# 捕获邮件纯文本内容到变量
set "body_content" "";
if body :matches "*" {
   set "body_content" "${1}";
}

# 发送包含原始内容的自动回复
vacation :subject "Re: ${subject}" text:
Thanks for your message.

Original message content:
${body_content}
.
;

说明:该方式仅捕获邮件的纯文本正文,如果需要捕获HTML格式内容,可将body :matches "*"替换为body :contenttype "text/html" :matches "*"。

方法2:直接附加原始邮件(更简便)

Sieve的vacation扩展自带:include参数,可直接将原始邮件作为附件插入回复,无需手动捕获内容,适用性更强。脚本修改如下:

require "variables";
require "vacation";

set "subject" "";
if header :matches "subject" "*" {
   set "subject" "${1}";
}

# 自动附加原始邮件到回复
vacation :subject "Re: ${subject}" :include "message/rfc822" text:
Thanks for your message.

The original message is attached below:
.
;

内容的提问来源于stack exchange,提问作者Krystian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 12:33:11