Command = "/usr/sbin/sendmail"; $this->TempFile = array(); $this->ToMail = ""; $this->ToName = ""; $this->FromMail = ""; $this->FromName = ""; $this->CcMail = array(); $this->CcName = array(); $this->BccMail = array(); $this->BccName = array(); $this->Subject = ""; $this->BodyText = ""; $this->boundary = "-----------------Boundary_" . uniqid("m"); } //----------------------------------------------------------------------------// // 添付ファイルON //----------------------------------------------------------------------------// function mSetTemp($flg) { $this->UseTemp = $flg; } //----------------------------------------------------------------------------// // SENDMAILコマンドオプション //----------------------------------------------------------------------------// function mSetCommand($str) { $this->Command = $str; } //----------------------------------------------------------------------------// // 送信先 //----------------------------------------------------------------------------// function mTo($aTo,$aName) { $this->ToMail = $aTo; if (!empty($aName)) { $aName = mb_convert_encoding($aName,"JIS",CharCode); $this->ToName = mb_encode_mimeheader($aName,"iso-2022-jp"); } } //----------------------------------------------------------------------------// // CC //----------------------------------------------------------------------------// function mCc($aCc,$aName) { array_push($this->CcMail,$aCc); if (!empty($aName)) { $aName = mb_convert_encoding($aName,"JIS",CharCode); $aName = mb_encode_mimeheader($aName,"iso-2022-jp"); array_push($this->CcName,$aName); } } //----------------------------------------------------------------------------// // BCC //----------------------------------------------------------------------------// function mBcc($aBcc,$aName) { array_push($this->BccMail,$aBcc); if (!empty($aName)) { $aName = mb_convert_encoding($aName,"JIS",CharCode); $aName = mb_encode_mimeheader($aName,"iso-2022-jp"); array_push($this->BccName,$aName); } } //----------------------------------------------------------------------------// // 送信元 //----------------------------------------------------------------------------// function mFrom($aFrom,$aName) { $this->FromMail = $aFrom; if (!empty($aName)) { $aName = mb_convert_encoding($aName,"JIS",CharCode); $this->FromName = mb_encode_mimeheader($aName,"iso-2022-jp"); } } //----------------------------------------------------------------------------// // 件名 //----------------------------------------------------------------------------// function mSubject($aSubject) { // $aSubject = mb_convert_encoding($aSubject,"JIS","SJIS"); // $this->Subject = mb_encode_mimeheader($aSubject,"iso-2022-jp"); // $this->Subject = i18n_mime_header_encode(i18n_convert($aSubject,"JIS")); $this->Subject = "=?iso-2022-jp?B?".base64_encode(mb_convert_encoding($aSubject,"JIS",CharCode))."?="; } //----------------------------------------------------------------------------// // 本文セット //----------------------------------------------------------------------------// function mBody($aBody) { $this->PipeCheck(); if ($this->UseTemp) { fputs($this->mPipe,"--".$this->boundary."\n"); fputs($this->mPipe,"Content-Type: text/plain; charset=\"iso-2022-jp\"\n"); fputs($this->mPipe,"Content-Transfer-Encoding: 7bit\n"); } fputs($this->mPipe,"\n"); $aBody = mb_convert_encoding($aBody,"JIS",CharCode); fputs($this->mPipe,$aBody); fputs($this->mPipe,"\n"); } //----------------------------------------------------------------------------// // パイプオープン //----------------------------------------------------------------------------// function PipeOpen() { $this->mPipe = popen($this->Command,"w"); if (!$this->mPipe) { print "メール送信できませんでした。(Can't open pipe to ".$this->tmp.")\n"; exit; } } //----------------------------------------------------------------------------// // パイプチェック //----------------------------------------------------------------------------// function PipeCheck() { if (!$this->mPipe) { print("メール送信できませんでした。(Pipe is not opened)\n"); exit; } } //----------------------------------------------------------------------------// // ヘッダのパイプ出力 //----------------------------------------------------------------------------// function mHeaderClose() { if (!$this->mPipe) { $this->PipeOpen(); } $this->PipeCheck(); fputs($this->mPipe, "From: ".$this->FromName." <" . $this->FromMail . ">\n"); fputs($this->mPipe, "To: ".$this->ToName." <" . $this->ToMail . ">\n"); for ($i=0;$iCcMail);$i++) { fputs($this->mPipe,"Cc: ".$this->CcName[$i]." <" .$this->CcMail[$i].">\n"); } for ($i=0;$iBccMail);$i++) { fputs($this->mPipe,"Bcc: ".$this->BccName[$i]." <" .$this->BccMail[$i].">\n"); } fputs($this->mPipe, "Subject: ".$this->Subject."\n"); if ($this->UseTemp) { fputs($this->mPipe, "MIME-Version: 1.0\n"); fputs($this->mPipe, "Content-Type: multipart/mixed; boundary=\"".$this->boundary."\"\n"); } fputs($this->mPipe, "\n"); } //----------------------------------------------------------------------------// // 添付ファイルセット //----------------------------------------------------------------------------// function mTempAdd(&$aData, $aFilename, $aType = "application/octet-stream" ){ if (empty($aFilename)) { $aFilename = uniqid("t"); } // $aFilename = i18n_mime_header_encode(i18n_convert($aFilename,"SJIS")); $aFilename = mb_convert_encoding($aFilename,"JIS",CharCode); $this->PipeCheck(); fputs($this->mPipe,"--".$this->boundary."\n"); fputs($this->mPipe,"Content-Type: $aType"."; name=\"" . $aFilename . "\"\n"); fputs($this->mPipe,"Content-Transfer-Encoding: base64\n"); fputs($this->mPipe,"Content-Disposition: attachment; filename=\"".$aFilename."\"\n"); fputs( $this->mPipe,"\n"); fputs( $this->mPipe,chunk_split(base64_encode($aData))); fputs( $this->mPipe,"\n"); } //----------------------------------------------------------------------------// // メール送信 //----------------------------------------------------------------------------// function mSend() { $this->PipeCheck(); if ($this->UseTemp ) { fputs($this->mPipe, "--" .$this->boundary ."--\n"); } pclose($this->mPipe); unset($this->mPipe); return true; } } ?> cRs

cRs

@

@

@llorllK{ @ll ll
O
K{
[AhX
K{
[AhX
imFjK{
X -
ZFs{
ZF
db - -
t@bNX - -