Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过smtp发送邮件时出现Laravel 5错误500_Php_Laravel_Email_Smtp - Fatal编程技术网

Php 通过smtp发送邮件时出现Laravel 5错误500

Php 通过smtp发送邮件时出现Laravel 5错误500,php,laravel,email,smtp,Php,Laravel,Email,Smtp,我想在我的网站上制作一个简单的联系表单,用户收到确认邮件,我收到用户发给我的文本。但不知怎么的,它不起作用,我不知道为什么 联系人控制器: public function sendMail(Request $request){ $this->validate($request, [ 'email' => 'required|email', 'name' => 'required', 'subject' =>

我想在我的网站上制作一个简单的联系表单,用户收到确认邮件,我收到用户发给我的文本。但不知怎么的,它不起作用,我不知道为什么

联系人控制器:

    public function sendMail(Request $request){

    $this->validate($request, [
        'email' => 'required|email',
        'name' => 'required',
        'subject' => 'required',
        'text' => 'min:10 | max:65536'
    ]);

    $data = [
        'email' => $request->input('email'),
        'name' => $request->input('name'),
        'subject' => $request->input('subject'),
        'text' => $request->input('text')
    ];

    Mail::to($request->input('email'))->send(new RequestReceived($data));
    Mail::to('test@velocityvideogroup.com')->send(new ContactEmail($data));

    $request->session()->flash('success', 'Request has been successfully sent!');
    return redirect('/contact');
}
}
邮件类别:

确认邮件:

class RequestReceived extends Mailable{

use Queueable, SerializesModels;


protected $data;
/**
 * Create a new message instance.
 *
 * @return void-
 */
public function __construct($data)
{
    $this->data = $data;
}

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->markdown('emails.received')
                ->subject('Velocity | Request received!')
                ->with([
                    'name' => $this->data['name'],
                    'text' => $this->data['text']
                ]);
    }
}
我应该收到的邮件:

class ContactEmail extends Mailable
{
use Queueable, SerializesModels;

protected $data;
/**
 * Create a new message instance.
 *
 * @return void
 */
public function __construct($data)
{
    $this->data = $data;
}

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->markdown('emails.contactemail')
                ->from($this->data['email'])
                ->subject($this->data['subject'])
                ->with([
                    'name' => $this->data['name'],
                    'text' => $this->data['text']
                ]);
    }
}
.env
文件:

MAIL_DRIVER=smtp
MAIL_HOST=send.one.com
MAIL_PORT=465
MAIL_USERNAME=test@velocityvideogroup.com
MAIL_PASSWORD=*************
MAIL_ENCRYPTION=tls

MAIL_FROM_ADDRESS=test@velocityvideogroup.com
MAIL_FROM_Name=Test

你检查日志了吗?你收到任何错误消息了吗?我没有收到错误消息,我确实检查了日志:/make it:)与我的网络主机的安全问题有关!