2012-02-17 59 views
2

如果回覆「票證」的人正在使用Gmail等郵件客戶端,那麼當我執行@message.body.decoded而不是他們鍵入的文本時,回覆將顯示整個對話線程。如何處理與郵遞員的電子郵件線程

有沒有一種方法來提取文本的只是一部分?

+0

我唯一能想到的就是把每一條消息都傳出去,並且對於一條消息去做它們的差異。 – 2012-02-17 15:00:59

回答

2

一般來說,現有的答覆格式化爲前面>。一種選擇是提取不以該字符開頭的行。

所以你看電子郵件作爲純文本,可以提取它。這裏是一個例子:

--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 
+0

這看起來像是最合理的解決方案,除非聯繫人無緣無故開始使用>。但這是一個小小的警告。 – 2012-02-17 15:15:23

+0

我不認爲這是最好的解決方案,因爲消息使用'>',但也與html中的原始消息混合。 – 2012-02-17 15:30:58

+0

我想我需要分開第一個獨特的部分,然後刪除'>'s – 2012-02-17 15:33:05