Send email, internal server error 500

Reached posted 3 years ago

Hey guys,

I have this form that the user fills out, on successful submit the form saves to the database and sends an email to the site administrator with the content of the form.

This worked fine until now where i get an internal server error 500.

I tried removing the email part of the controller, and now the submit goes through just fine. However that is obviously not what I want.

I attached my code below:


	public function postCreate() {
	$validator = Validator::make(Input::all(), Order::$rules);

	if ($validator->passes()) {

		$order = new Order;
		$order->id = Input::get('id');
		$order->activity_title = Input::get('activity_title');
		$order->date = Input::get('date');
		$order->firstName = Input::get('firstName');
		$order->lastName = Input::get('lastName');
		$order->email = Input::get('email');
		$order->streetName = Input::get('streetName');
		$order->zip = Input::get('zip');
		$order->city = Input::get('city');
		$order->additional = Input::get('additional');

		$data = ['order'=> $order];

		Mail::send('emails.order', $data, function($message) use ($order)
	        $message->to('[email protected]')
	        	->subject("Ny ordre");


		return Response::json(['success'=>'true']);

Reached replied 3 years ago Solution

So so so embarrasing, however I will tell, so that ANYONE in the future with a similar problem can check for this silly mistake..

I recently changed my password on my gmail account, of course I didn't change the password in the mail configuration file accordingly thus making my emails never arrive.

Everything is working fine now, so in the future, remember to check for the most silly options first.

<note>Check your configurations.</note>

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us