PHP code example of ukkz / mailparser

1. Go to this page and download the library: Download ukkz/mailparser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ukkz / mailparser example snippets


use MailParser\Mailparser;

// 標準入力より
$entire_message = file_get_contents('php://stdin');

// このクラス
$mailparser = new MailParser($entire_message);

$sender_address = $mailparser->addressFrom();
$target_address = $mailparser->addressTo();
$mail_title = $mailparser->subject();
$text_body = $mailparser->getBody()->readText();

// 好きな形式で出力など
echo "From: $sender_address \n$text_body";