lundi 14 décembre 2015

Laravel 5 sending email via mandrill errors

My mail.php `

'driver' => 'smtp',
'host' => 'smtp.mandrillapp.com',
'port' => 587,
'from' => ['address' => 'mohaimin.moin10011@gmail.com', 'name' => null],
'encryption' => 'tls',
'username' => 'mohaimin.moin10011@gmail.com',
'password' => 'mandrill-api-key',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,`

in my controller after saving some information in some database table, email code is

$data = array(
                'name'=>$contactName, 
                'email'=>$contactEmail, 
                'messageObj'=>$contactMessage,
                'checkdate'=>$Formatdate,
                'refno'=>$ReferenceNo,
                'ct'=>$Comment,
                'b'=> Input::get('qccheckdetailsqty') 

                );
Mail::send('emails.email' ,$data, function($message) use ($contactEmail, $contactName)
{   
    $message->to('esharif21@gmail.com')->subject('Mail send cheque');
    $message->from($contactEmail, $contactName);
});

where,

$contactName = $contactName = 'Moin';
            $contactEmail = 'mohaimin.moin10011@gmail.com';
            $contactMessage = 'Quality Check';
            $DateOfCheck = Input::get('DateOfCheck');
            $Formatdate = date("d-m-Y", strtotime($DateOfCheck));
            $ReferenceNo = Input::get('ReferenceNo');
            $Comment = Input::get('Comment');

and my route is

Route::post('/storeQccheck', 'QccheckController@store');

my emails.email view is

 <!DOCTYPE html>
    <html lang="en-US">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
    <div>
     Checking date {!! $checkdate !!} and the Reference is  {!! $refno !!} and 
    Comment {!! $ct !!}.
      </div>
     </div>
    </body>
  </html>

but instead of sending email it shows MethodNotAllowedHttpException in RouteCollection.php line 207:. What and where is wrong in my code.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire