mardi 14 mars 2017

i just want to pass mail from my gmail account in laravel but it generate error

i just want to pass mail from my gmail account in laravel but it generate errors

my code:
Routes.php
Route::get('/sendbasicemai','MailController@basic_email');

i change in .env file as below
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=abx.xyz@gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=null

and in config.php
array (
    'driver' => 'smtp',
    'host' => 'smtp.gmail.com',
    'port' => '465',
    'from' => 
     array (
      'address' => NULL,
      'name' => NULL,
    ),
    'encryption' => NULL,
    'username' => 'abc.xyz@gmail.com',
    'password' => '*********',
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => false,
    ),

 MailController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Mail;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class MailController extends Controller
{
public function basic_email(){
   $data = array('name'=>"Virat Gandhi");

  Mail::send(['text'=>'mail'], $data, function($message) {
     $message->to('abc@xyz.in', 'Tutorials Point')->subject
        ('Laravel Basic Testing Mail');
     $message->from('abc.xyz@gmail.com','Virat Gandhi');
  });
  echo "Basic Email Sent. Check your inbox.";
  }
}

Mail.blade.php 
<h1>Hi, </h1>
<p>Sending Mail from Laravel.</p>

i am fresher in laravel and i just refere this link tutorial

but it generate bunch of errors: Whoops, looks like something went wrong. 1/1 Swift_TransportException in AbstractSmtpTransport.php line 383: ...... and much mor



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire