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.