Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

覚書

最初の空行の位置を返す
$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ヘッダとマルチパートの境目を探すやり方。ヘッダとパートの間に必ず空行(改行のみの行)が入るので境目を探してやればそこの位置以降はパートだと解る。

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

next1ka2u
2017年02月からJavascriptやPHP、MYSQLを学び始める。PHPとMYSQLをベタで書いてる人。ほぼネットで検索したことの独学の為、コードがきちゃない。クラスとかオブジェクト指向が解ってない手続き型のみでPHPを書いてる人。Qiitaはチラ裏程度に書いてる。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした