我在本地对 Laravel(联系页面)进行了更改,导致错误
此外查询存储在存储数据库中,没有任何问题
错误是:
Swift_TransportException
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
"
应用程序->控制.php:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model
{
public $table = 'contact';
public $fillable = ['name','name2','email','subject','note'];
}
app->http->controllers->ContactController.php :
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model
{
public $table = 'contact';
public $fillable = ['name','name2','email','subject','note'];
}
资源->查看->前置->contact.blade.php:
<form method="post" class="contact-validation-active" id="contact.store">
{{ csrf_field() }}
<div>
<input type="text" class="form-control" name="name" id="name" placeholder="First Name">
</div>
<div>
<input type="text" class="form-control" name="name2" id="name2" placeholder="Last Name">
</div>
<div class="clearfix">
<input type="email" class="form-control" name="email" id="email" placeholder="Email">
</div>
<div>
<input type="text" class="form-control" name="subject" id="subject" placeholder="Subject">
</div>
<div>
<textarea class="form-control" name="note" id="note" placeholder="Case Description..."></textarea>
</div>
<div>
<input type="hidden" name="recaptcha" id="recaptcha">
</div>
<div class="submit-area">
<button type="submit" class="theme-btn submit-btn">Send Message</button>
<div id="loader">
<i class="ti-reload"></i>
</div>
</div>
<div class="clearfix error-handling-messages">
<div id="success">Thank you</div>
<div id="error"> Error occurred while sending email. Please try again later. </div>
</div>
</form>
资源->查看->前置-> email.blade.php:
You received a message from : {{ $name }}
<p>
Name: {{ $name }}
</p>
<p>
First Last name: {{ $name2 }}
</p>
<p>
Subject: {{ $subject }}
</p>
<p>
Email: {{ $email }}
</p>
<p>
Message: {{ $user_message }}
</p>
路线-> web.php:
Route::get('contact', 'ContactController@contact');
Route::post('contact', ['as'=>'contact.store','uses'=>'ContactController@contactPost']);
.导航:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=m******@gmail.com
MAIL_PASSWORD=*********
MAIL_ENCRYPTION=465
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME="${APP_NAME}"