I'm trying to send an email through Laravel from a form that has two different file inputs with different names, cv and cover_letter.
The build function works just fine but it only attaches one file when it sends the email, I'd like it to send both.
I've tried this solution here on SO but no luck sending both attachments either.
public function build(Request $request)
{
$today = Carbon::now()->format('Y-m-d');
return $this->from([
'email' => $request->email,
'name' => $request->name
])
->to( 'jobs@domain.com' )
->subject( New job application '.$request->name.' for the position of '.$request->role.'.')
->view('emails.jobsform')
->with([
'name' => $request->name,
'tel' => $request->tel,
'email' => $request->email,
'role' => $request->role,
'location' => $request->location,
'call_code' => $request->call_code,
])
->attach(
$request->cv, [
'as' => $today.".".$request->name.".".$request->role.'.pdf',
'mime' => 'application/pdf'],
$request->cover_letter, [
'as' => $today.".".$request->name.".".$request->role.'-Cover Letter.pdf',
'mime' => 'application/pdf']
);
}
Hope someone can help, thanks.