$localFilePath = storage_path()."/app/tous/sales_return/";
$fileNameList = array_filter(array_map(function ($element){
if ($element != '.' && $element != '..'){
return $element;
}
},scandir($localFilePath)));
$emailInfo = ['localFilePath'=>$localFilePath,'filename'=>$fileNameList];
$toList = ['123@qq.com','345@qq.com'];
$subject = '销售/退货每日汇总';
$messages['view']['view_type'] =1;
$messages['view']['attachment'] =1;
Mail::send('verify/verify_email',['subject'=>$subject,'messages'=>$messages,'time'=>date('Y-m-d H:i:s')],function($message) use ($toList,$subject,$emailInfo){
foreach ($toList as $val) {
$message->to($val);
}
foreach ($emailInfo['filename'] as $value){
$message->attach($emailInfo['localFilePath'].$value);
}
$message->subject($subject);
});
|