电子邮件将发送,但文件将不附加。有什么想法吗?
public function email_invoice(Request $request, $id){
$customer = customer::findOrFail($id);
Mail::send('emails.invoice', ['customer' => $customer], function ($m) use ($customer) {
$sender_name = Auth::user()->name;
$sender_email = Auth::user()->email;
$m->from( $sender_email, $sender_name);
$m->to($customer->email)->subject('Invoice Attached');
$m->attach('User/myName/invoice.pdf');
});
}
答案 0 :(得分:0)
您必须像这样使附加功能用于电子邮件附件
$m->attach($file->getRealPath(), array(
'as' => $file->getClientOriginalName(), // If you want you can chnage original name to custom name
'mime' => $file->getMimeType())
);