如果回复“票证”的人使用 Gmail 等邮件客户端,则当我执行 @message.body.decoded
时,回复将显示整个对话线程,而不是他们发送的文本键入。
有没有办法只提取那部分文本?
最佳答案
通常,现有回复的格式是前面带有 >
。一种选择是提取不以该字符开头的行。
因此,您将电子邮件视为纯文本,可以将其提取。这是一个例子:
--f46d0basically0a0unique0id # Marks the start of content for this email
Content-Type: text/plain; charset=ISO-8859-1
Hello foo,
This is a message.
Regards,
Bar
>
> Original response
> is quoted like this
> What in included here
> depends on mail client
>
--f46d0basically0a0unique0id # Marks the end of content for this email
关于ruby-on-rails - 如何使用 mailman 处理电子邮件线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9330178/