0

I can hard code an email an get it to send, but for life of me I can't get a variable to pass through an email or to get it to send to an address entered in my form. When i'm trying to send it to the email entered in the form I'm getting this error Swift_RfcComplianceException in MailboxHeader.php line 348: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. This is my code is far: first is the form method

class ContactController extends Controller {
public function Index()
{

    $email  = Input::get('email');
    $name = Input::get('name');
    $phone = Input::get('phone');
    $subject = Input::get('subject');
    $message = Input::get('message');

    session_start();
    $_SESSION['email'] = $email;
    $_SESSION['name'] = $name;
    $_SESSION['phone'] = $phone;
    $_SESSION['subject'] = $subject;
    $_SESSION['message'] = $message;

return View('contact_views.Index');
}

This is what I have in my post method:

public function Contact()
{
    session_start();
    $email = $_SESSION['email'];

        Mail::send('Email.Contact_Email', [], function ($message) use($email)
        {
            $message->to($email)->subject('test');
        });


    return View('contact_views.Contact');
}

I'm new to laravel and I know a lot people like it and find it to be a easy framework, but I don't know why lol. This was way easier to do in asp.net. Please help and thank you in advance if you do.

Vantheman6
  • 1,719
  • 3
  • 13
  • 13
  • Why are you starting sessions manually? Laravel does all of this for you - you should read the docs on sessions – Laurence Mar 18 '15 at 16:03
  • Yeah I totally didn't try there man.... I was thinking maybe a more detailed overview. Last time a i checked that's a suggestion and not answer. Should i also use google? lol – Vantheman6 Mar 18 '15 at 16:29

0 Answers0