Skip to content

Instantly share code, notes, and snippets.

@adatta02
Created February 9, 2013 00:03
Show Gist options
  • Save adatta02/4743025 to your computer and use it in GitHub Desktop.
Save adatta02/4743025 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
require_once 'config.php';
require_once('MimeMailParser/MimeMailParser.class.php');
$total = "";
$stdin = fopen('php://stdin', 'r');
while (($buffer = fgets($stdin)) !== false) {
$total .= $buffer;
}
$fname = tempnam(sys_get_temp_dir(), 'hpv');
file_put_contents( $fname, $total );
$Parser = new MimeMailParser();
$Parser->setPath( $fname );
$msgInfo = array(
"to" => $Parser->getHeader('to'),
"from" => $Parser->getHeader('from'),
"subject" => $Parser->getHeader('subject'),
"plain_body" => $Parser->getMessageBody('text'),
"html_body" => $Parser->getMessageBody('html')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment