setUsername('YOUR_GMAIL_USERNAME') // ->setPassword('YOUR_GMAIL_PASSWORD') // ; // // $transport = \Swift_SmtpTransport::newInstance($host, $port); // set encryption if (isset($encryption)) $transport->setEncryption($encryption); // set username and password if (isset($username)) { $transport->setUsername($username); $transport->setPassword($password); } // // // // Create the Transport // // Create the Mailer using your created Transport // $mailer = new Swift_Mailer($transport); /********************* We may need to fetch a new token on behalf of the client ******************************/ $transport = (new Swift_SmtpTransport('smtp.gmail.com', 587, 'tls')) ->setAuthMode('XOAUTH2') ->setUsername('turbo124@gmail.com') ->setPassword(''); // set new swift mailer Mail::setSwiftMailer(new \Swift_Mailer($transport)); Mail::to('david@romulus.com.au') ->send('test'); } }