My project use Google Mail. My views:
{!! Form::file('fileToUpload') !!}
My controller:
use Mail;
$input = $request->all();
$data = [
'confirm' => 'confirm',
'author' => 'ADMIN',
'address' => 'mail@mail.com',
'subject' => 'Send',
'contents' => 'Hello'];
Mail::send(['view' => 'mail'], $data, function($message) use ($data){
$message->to($data['address'])
->cc($data['address'])
->subject($data['subject'])
->setBody($data['contents']);
if(isset($input['fileToUpload'])){
$message->attach($input['fileToUpload']->getRealPath(),
array(
'as' => $input['fileToUpload']->getClientOriginalName(),
'mime' => $input['fileToUpload']->getMimeType()));
}
$message->from('rootpowercontrol@gmail.com', 'ADMIN');
I can send email. But, attached file can not send. Something went wrong. Anybody help me. Thanks. Source: https://github.com/HoanNguyenIM/package_mail
via InfinityM