我只想在laravel中从我的Gmail帐户传递邮件,但它会产生错误
module.exports = function(config) {
config.set({
frameworks: ["jasmine", "karma-typescript"],
files: [
{ pattern: "base.spec.ts" },
{ pattern: "src/app/**/*.+(ts|html)" }
],
exclude: [
'examples/**/*.js',
'examples/**/*.ts'
],
preprocessors: {
"**/*.ts": ["karma-typescript"]
},
karmaTypescriptConfig: {
bundlerOptions: {
entrypoints: /\.spec\.ts$/,
transforms: [
require("karma-typescript-angular2-transform")
]
},
coverageOptions: {
instrumentation: true
}
},
reporters: ["progress", "karma-typescript"],
browsers: ["Chrome"]
});
};
我是laravel的新手,我刚读了这个链接tutorial
我只是练习"教程"建议和我在当地主人练习
但它会产生大量错误:
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, {{ $name }}</h1>
<p>Sending Mail from Laravel.</p>
以及更多