Answers for "send mail in laravel"

PHP
3

email validation in laravel

'email' => 'required|email|unique:users,email',
//@sujay
Posted by: Guest on October-09-2020
3

send multiple mail in laravel

$emails = ['[email protected]', '[email protected]','[email protected]'];

Mail::send('emails.welcome', [], function($message) use ($emails)
{    
    $message->to($emails)->subject('This is test e-mail');    
});
var_dump( Mail:: failures());
exit;
Posted by: Guest on October-13-2020
0

send html email laravel

// $data => array of information passed to view
Mail::send('email_view', $data, function ($m) use ($user) {
                $m->from("[email protected]", config('app.name', 'APP Name'));
                $m->to($user->email, $user->email)->subject('Email Subject!');
            });
Posted by: Guest on May-28-2021
0

laravel send email

//  admin.newsletters.send_email : is the blade that will have your email content
  // 'newsletter' => $newsletter : is the collection to be used in the blade file
  // function ($message) : the function email and the variable to be used in the message.
//  use ($newsletter) : is the collection to be used in the message controller (e.g $message->to($newsletter->email))
  // Swift_TransportException to check if it is real email


namespace App\Http\Controllers\Admin;
use Mail;

      public function sendEmail(Newsletter $newsletter)
    {

try {          
  Mail::send('admin.newsletters.send_email', ['newsletter' => $newsletter], function ($message) use ($newsletter) {
    $message->from('[email protected]', 'eee-services.com');

    $message->to('[email protected]')->subject('Newsletter');
  });
      } catch (\Swift_TransportException $e) {
        if ($e->getMessage()) {
          return redirect()->route('admin.newsletters.index');
        }
      }

  return redirect()->route('admin.newsletters.index');
  }
Posted by: Guest on August-25-2021
0

email validation in laravel

$validator = Validator::make($request->all(), []);

 $validator->sometimes('email', 'unique:users,email', function ($input) {
            return $input->email !== Auth::user()->email;
        });
//@sujay
Posted by: Guest on October-09-2020
1

laravel mail send text

Mail::raw('Text to e-mail', function ($message) {
    //
});
Posted by: Guest on July-19-2021

Browse Popular Code Answers by Language