Changeset View
Changeset View
Standalone View
Standalone View
externals/mimemailparser/MimeMailParser.class.php
| Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | class MimeMailParser { | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the email text | * Set the email text | ||||
| * @return Object MimeMailParser Instance | * @return Object MimeMailParser Instance | ||||
| * @param $data String | * @param $data String | ||||
| */ | */ | ||||
| public function setText($data) { | public function setText($data) { | ||||
| // NOTE: This has been modified for Phabricator. If the input data does not | |||||
| // end in a newline, Mailparse fails to include the last line in the mail | |||||
| // body. This happens somewhere deep, deep inside the mailparse extension, | |||||
| // so adding a newline here seems like the most straightforward fix. | |||||
| if (!preg_match('/\n\z/', $data)) { | |||||
| $data = $data."\n"; | |||||
| } | |||||
| $this->resource = mailparse_msg_create(); | $this->resource = mailparse_msg_create(); | ||||
| // does not parse incrementally, fast memory hog might explode | // does not parse incrementally, fast memory hog might explode | ||||
| mailparse_msg_parse($this->resource, $data); | mailparse_msg_parse($this->resource, $data); | ||||
| $this->data = $data; | $this->data = $data; | ||||
| $this->parse(); | $this->parse(); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 338 Lines • Show Last 20 Lines | |||||