php - laravel 5 send email with html elements and attachment using ajax -
i stuck on point want send email using ajax. find code below.
$user = \auth::user(); mail::send('emails.reminder', ['user' => $user], function ($message) use ($user) { $message->from('xyz@gmail.com', 'from'); $message->to($request['to'], $name = null); // $message->cc($address, $name = null); // $message->bcc($address, $name = null); $message->replyto('xyz@gmail.com', 'sender'); $message->subject($request['subject']); // $message->priority($level); if(isset($request['attachment'])){ $message->attach($request['attachment'], $options = []); } // attach file raw $data string... $message->attachdata($request['message'], $name = 'dummy name', $options = []); // underlying swiftmailer message instance... $message->getswiftmessage(); }); return \response::json(['response' => 200]);
now want send email using ajax , upon request complete want display message on same page message sent successfully.
i found solution this, send plain message directly using mail::raw()
function working perfectly. not able attach files here or html codes.
any suggestion in regard.
Comments
Post a Comment