首頁 >後端開發 >php教程 >发附件有关问题,mb_send_mail不可以,mail可以,为啥

发附件有关问题,mb_send_mail不可以,mail可以,为啥

WBOY
WBOY原創
2016-06-13 10:19:021159瀏覽

发附件问题,mb_send_mail不可以,mail可以,为啥?
很着急啊,
求解。
谢谢先
以下是我的程序:



$from   .=   "   ";

$to       .=   "   ";

$subject         =   "添付ファイルテスト ";
$body               =   "添付ファイルテスト正文 ";

$filename       =   "/work/cgi-bin/prs/test.txt ";
$att_files       =   "/work/cgi-bin/prs/テストファイル.txt ";
//$mine               =   "js ";

//send_mail2($to,   $subject,   $text_body,   $headers,   $html_body= " ",   $att_names= " ",   $att_files= " ",   $file_types= " ");
/*
if   ($filename){
($attach   =   file_get_contents($filename))   Or   die( "Open   Error:   $filename ");
$filename   =   basename($filename);
$ret   =   Attach_Mail($from,   $to,   $subject,   $body,   $filename,   $attach,   $mine);
}else{

}
*/
$ret   =   send_mail($to,   $from,   $subject,   $body,   $cc   =   null,   $bcc   =   null,   $filename);
//echo   $ret;

function   send_mail($to,   $from,   $subject,   $body,   $cc   =   null,   $bcc   =   null,   $attachment   =   null)
{
if   ($to     !=   " "     &&     isset(   $to     )     )   {
$to   =str_replace(   "   "   ,   " "   ,   $to     )   ;
$to   =str_replace(   "\t "   ,   ", "     ,   $to     )   ;  
}
if   ($cc     !=   " "     &&     isset(   $cc     )     )   {
$cc   =str_replace(   "   "   ,   " "   ,   $cc     )   ;
$cc   =str_replace(   "\t "   ,   ", "     ,   $cc     )   ;  
}
if   ($bcc     !=   " "     &&     isset(   $bcc     )     )   {
$bcc   =str_replace(   "   "   ,   " "   ,   $bcc     )   ;
$bcc   =str_replace(   "\t "   ,   ", "     ,   $bcc     )   ;  
}

//   念の為、言語と文字コードの設定
$body   =   "BCC:$bcc\r\n$body\r\n ";
$body   =   "CC:$cc\r\n$body\r\n ";
$to_tmp   =   join( "\r\n       ",explode( ", ",$to));
$body   =   "TO:$to_tmp\r\n$body\r\n ";

mb_language( "Japanese ");
mb_internal_encoding( "EUC-JP ");
mb_detect_order( "ASCII,   JIS,   UTF-8,   EUC-JP,   SJIS ");

//   From   を変換
//$FromName   =   mb_encode_mimeheader(mb_convert_encoding($FromName, 'JIS ', 'auto '));
//$header   .=   'From: '.$FromName. '   '. "\r\n ";
$to   =   "[email protected] ";

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn