Qdmail - PHP::Mail Library , Quick and Detailed for Multibyte

潟<潟若紊違泣潟

潟<潟若紊ゃ潟<潟若紊泣若
Qdmail + QdReceiver潟<潟3腮篏泣若鴻膣剛障
с違膣剛障

潟帥泣若種ゃ潟帥若鴻帥潟若
篆<<若с≪帥ゃPHP違ゃ潟帥若с≪帥ゃ<若т
#!/usr/local/php-5.2.6/bin/php-cgi

<?php

include('inc/qdmail.php');
include('inc/qdmail_receiver.php');

//
//罔羣ュ<若絎鴻莨若
//
$content = '';
$fp=fopen("php://stdin",'r') or die('File Open Error');
 while( !feof($fp) ){
    $content .= fgets( $fp );
 }
//
//<若潟若(Qdreceiver)
//
$DECODE = QdmailReceiver::start('direct',$content);
$from = $DECODE -> header(array('from','mail'));
$subject_summary = mb_substr(
    $DECODE -> header( array('subject','name') ) , 0 , 10
);

if(empty($subject_summary)){
    $subject_summary = 'Qdmail';
}else{
    $subject_summary .= 'tpl';
}

$cc = $DECODE -> header(array('cc','mail'));

//
//潟<潟若吾紊鐚3c鐚
//
$kinds = array('TPL_DC','TPL_AU','TPL_SB');
$carrier = array(
    'TPL_DC'=>'Docomo',
    'TPL_AU'=>'au',
    'TPL_SB'=>'SoftBankMobile'
);
$mime = array(
    'TPL_DC'=>'application/x-decomail-template',
    'TPL_AU'=>'application/x-kddi-htmlmail',
    'TPL_SB'=>'application/x-htmlmail-template'
);
$kakuchou = array('TPL_DC'=>'dmt','TPL_AU'=>'khm','TPL_SB'=>'hmt');

$ct = 0;
$mail = Qdmail::getInstance();

foreach($kinds as $kind){
    $attach[$ct]['DIRECT'] = $mail -> makeDecoTemplate($kind,$content);
    $attach[$ct]['PATH'] = $subject_summary.'_'.$carrier[$kind].'.'.$kakuchou[$kind];
    $attach[$ct]['MIME_TYPE'] = $mime[$kind];
    $ct++;
}
//
//腟篆
//
$add_header['From']='*****@*****.net';
$add_header['Reply-To']='****@*****.jp';

$to = array();
if(!empty($from)){
    $to[]=array($from);
}
if(!empty($cc)){
    $to[]=array($cc);
}

//若我
foreach($to as $key => $ad){
    if( false !== strpos($ad[0],'@****.****') ){
        unset($to[$key]);
    }
}


if(0===count($to)){
    die('Illegal Mail');
}


$mail -> reset();//cQdmail鴻祉鐚綽泣鐚
$body=<<<EOF
潟若絮障
綵鴻腴c蚊筝с膣剛

au潟若祉фゃ
羂ャ鴻頳潟俄札筝泣ゃ障с絲筝

Spok
http://hal456.net/
http://hal456.net/qdmail/decomail_base
http://www.cpa-lab.com/tech/
EOF;

$fg=qd_send_mail(
    'text',
    $to,
    '潟3腮潟若鐚荅薑鐚',
    $body,
    $add_header,
    $attach
);