I have some problem with sending invitation emails with My laravel app. this is My email form
@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">
</div>
@endif
<form class="form-horizontal" role="form" method="POST" action="">
<div class="form-group">
<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="">
@if ($errors->has('email'))
<span class="help-block">
<strong></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!']);
}
//
}
routes
Route::get('projects/{projects}/collaborators/invitationemail','EmailsController@send');
when I going to send emal link it is generated following error
Swift_RfcComplianceException in MailboxHeader.php line 347:
Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
but amaizing when I change EmailsController as this
<?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!']);
}
//
}
email send without opening My email sending form....... I need open email sending form and send to different emails address can you help me
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire