0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

メールの生データの最初の空行

Last updated at Posted at 2017-11-04

覚書

最初の空行の位置を返す
$html_buf= file_get_contents("original_msg.txt");
$blank = '/^\r\n$/m'; //CRLF
preg_match($blank, $html_buf, $matches, PREG_OFFSET_CAPTURE);

var_dump($matches);
echo $matches[0][1] + 1;// 初めの空行の次の行を指定
出力
array (size=1)
  0 =>array (size=2)
      0 => string '' (length=2)
      1 => int 248878
248879

メールのMIMEヘッダとマルチパートの境目を探すやり方。ヘッダとパートの間に必ず空行(改行のみの行)が入るので境目を探してやればそこの位置以降はパートだと解る。

自分の記事リンク:メールの生データ:メーラーの改行

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?