Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@next1ka2u

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

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

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

0
Help us understand the problem. What is going on with this article?
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
next1ka2u
2017年02月からJavascriptやPHP、MYSQLを学び始める。PHPとMYSQLをベタで書いてる人。ほぼネットで検索したことの独学の為、コードがきちゃない。クラスとかオブジェクト指向が解ってない手続き型のみでPHPを書いてる人。Qiitaはチラ裏程度に書いてる。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?