Twittler
275
14
Laravel

Laravel Mail does not send to mailtrap

Posted 4 months ago by Twittler

Hi guys, i'm having trouble sending mail i'm using mailtrap. Page redirects without errors and do not send mail, sometimes it says "Process could not be started [The system cannot find the path specified. ]" i have tried using mail_driver = mail but that do not work.

.env

MAIL_DRIVER=smtp

MAIL_HOST=smtp.mailtrap.io

MAIL_PORT=2525

MAIL_USERNAME=ffc415fa96e9b8

MAIL_PASSWORD=4c04fc5918df03

MAIL_ENCRYPTION= tls

Controller public function PostContact(Request $request) {

  $data = array(
    'email' => $request -> email,
    'subject' => $request -> subject,
    'bodyMessage' => $request -> message
  );

  Mail::send('emails.contact', $data, function($message) use ($data){
    $message -> from($data['email']);
    // $message -> to($data['[email protected]']);
    $message ->subject($data['subject']);
  });

  Session::flash('success', 'Your Email was sent!');

  return redirect() -> back();

}

Thanks!

Please sign in or create an account to participate in this conversation.