dimanche 6 mars 2016

how to send email using laravel

hi there i'm trying to send an email but i can't move anymore and that's my view :

<h1>Contact TODOParrot</h1>


<form action="contact" method="post">

<div class="form-group">
 <label>Your First Name</label>
 <input type="text" name="Fname" placeholder="Your First Name" />
</div>

<div class="form-group">
  <label>Your Last Name</label>
  <input type="text" name="Lname" placeholder="Your Last Name" />
</div>

<div class="form-group">
<label>Your Email</label>
  <input type="email" name="Email" placeholder="Your Email" />
</div>
<div class="form-group">
<label>Your Phone Number</label>
  <input type="text" name="Phone" placeholder="Your Phone" />
</div>
<div class="form-group">
<label>Your Order</label>
  <input type="text" name="Order" placeholder="Your Order" />
</div>

<div class="form-group">
    <button class="btn btn-default" name="Submit" type="Submit">Send Order</button>
</div>
</form>

and that is my controller :

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests\ContactFormRequest;


class aboutController extends Controller
{
    //
    public function create()
    {
        return view('about.contact');
    }

    public function store(ContactFormRequest $request)
    {
        \Mail::send('about.contact',
        array(
            'Fname' => $request->get('Fname'),
            'Lname' => $request->get('Lname'),
            'Email' => $request->get('Email'),
            'Phone' => $request->get('Phone'),
            'Order' => $request->get('Order')
        ), function($message)
    {
        $message->from('mohamedsasa201042@yahoo.com');
        $message->to('elbiheiry2@gmail.com', 'elbiheiry')->subject('TODOParrot Feedback');
    });

        return \Redirect::route('contact')
      ->with('message', 'Thanks for contacting us!');
    }
}

and that's my route :

Route::get('contact', 
  ['as' => 'contact', 'uses' => 'AboutController@create']);
Route::post('contact', 
  ['as' => 'contact', 'uses' => 'AboutController@store']);

when i press send it gives me 'Forbidden' as a message can anyone help ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1QDuIH7
via IFTTT

Aucun commentaire:

Enregistrer un commentaire