欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-04-10 19:01:54
...
发附件问题,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] ";
发附件有关问题,mb_send_mail不可以,mail可以,为啥

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频