我在使用My laravel应用程序发送邀请电子邮件时遇到一些问题。这是我的电子邮件表格
@extends('layouts.app')
<!-- Main Content -->
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Send E-Mail Invitation</div>
<div class="panel-body">
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
<form class="form-horizontal" role="form" method="POST" action="{{ url('/collaborators/invitationemail') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}">
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-envelope"></i> Send Invitation Link
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
EmailsController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Mail;
class EmailsController extends Controller
{
public function send(Request $request)
{
$email = $request->get('email');
Mail::send('emails.send', ['email' => $email], function ($message) use ($email)
{
$message->from('anyone.max@gmail.com', 'Andrew');
$message->to($email);
});
return response()->json(['message' => 'Invitation Email Sent!']);
}
//
}
路由
Route::get('projects/{projects}/collaborators/invitationemail','EmailsController@send');
当我要发送emal链接时,它会在错误后生成
Swift_RfcComplianceException in MailboxHeader.php line 347:
Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
但是当我将EmailsController更改为
时会感到惊讶<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Mail;
class EmailsController extends Controller
{
public function send(Request $request)
{
$email = $request->get('email');
Mail::send('emails.send', ['email' => $email], function ($message) use ($email)
{
$message->from('amal.fernandomax@gmail.com', 'Acxian');
$message->to('somaakka@gmail.com');
});
return response()->json(['message' => 'Invitation Email Sent!']);
}
//
}
电子邮件发送而不打开我的电子邮件发送表格.......我需要打开电子邮件发送表格并发送到不同的电子邮件地址,你能帮助我