0

我有一个后缀服务器将所有传入的邮件重定向到一个 php 脚本

但邮件的正文内容似乎重复,看起来:

--000e0ce03cf6d06b0c04c67595d4
Content-Type: text/plain; charset=ISO-8859-1

why
show
this
duplicated?

--000e0ce03cf6d06b0c04c67595d4
Content-Type: text/html; charset=ISO-8859-1

why<div>show</div><div>this</div><div>duplicated?</div>

--000e0ce03cf6d06b0c04c67595d4--

我已经使用带有此正文内容的 gmail 发送了这封邮件:

why
show
this
duplicated?

为什么会出现两次邮件?(和一个在 html 中:S)

我怎样才能只得到一个?谢谢!

4

1 回答 1

2

假设您的代码返回相同类型的分隔符,一种方法可能是执行以下操作:

// Get separator
$mail_pieces = explode("\n", $mail);
$separator = $mail_pieces[0];

// Separate email
$mail_pieces = explode($separator, $mail);
$text_mail = $mail[0];
$html_mail = $mail[1];
于 2012-08-04T19:35:55.473 回答