Mail issue with Laravel, Mandrill and GuzzleHttp

Update: changed to use Gmail's SMTP while developing on my local VM. There is zero issues there. Cannot fathom why Mandrill doesn't work. So overall, this blog post was not helpful at all in the end

Update: it just seems to work at complete random - has been happening the past two/three days. Maybe an issue with Mandrills servers?

Update: tried changing the API key. Still the same issue

Update: I can ping https://mandrillapp.com/api/1.0/messages/send-raw.json absolutely fine, so disregard the entire post until I find an answer

I’m currently working remotely from home, where the internet is unstable to say the least (hopefully get his fixed today or early next week). I was wondering why Mail::queue kept failing, so I changed it to Mail::send instead. I kept getting an NGINX gateway timeout error, so I was puzzled for a few hours as it just happened at seemly random. Now it seems so obvious, my virtual machine that I developing from sometimes fails to connect to the Mandrill servers as the internet drops (D’oh!). So if you see an error in your logs like the following, check your internet connection and its stability before you go trawling through Google to try and find your answer.

[2015-05-09 09:32:51] local.ERROR: exception 'GuzzleHttp\Exception\RequestException' with message 'Error creating resource. [url] https://mandrillapp.com/api/1.0/messages/send-raw.json' in /project/vendor/guzzlehttp/guzzle/src/Adapter/StreamAdapter.php:178
Stack trace:
#0 /project/vendor/guzzlehttp/guzzle/src/Adapter/StreamAdapter.php(371): GuzzleHttp\Adapter\StreamAdapter->createResource(Object(Closure), Object(GuzzleHttp\Message\Request), Array)
#1 /project/vendor/guzzlehttp/guzzle/src/Adapter/StreamAdapter.php(218): GuzzleHttp\Adapter\StreamAdapter->createStreamResource(Object(GuzzleHttp\Message\Request), Array, Resource id #11, NULL)
#2 /project/vendor/guzzlehttp/guzzle/src/Adapter/StreamAdapter.php(62): GuzzleHttp\Adapter\StreamAdapter->createStream(Object(GuzzleHttp\Message\Request), NULL)
#3 /project/vendor/guzzlehttp/guzzle/src/Adapter/StreamAdapter.php(52): GuzzleHttp\Adapter\StreamAdapter->createResponse(Object(GuzzleHttp\Adapter\Transaction))
#4 /project/vendor/guzzlehttp/guzzle/src/Client.php(193): GuzzleHttp\Adapter\StreamAdapter->send(Object(GuzzleHttp\Adapter\Transaction))
#5 /project/vendor/guzzlehttp/guzzle/src/Client.php(181): GuzzleHttp\Client->send(Object(GuzzleHttp\Message\Request))
#6 /project/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php(65): GuzzleHttp\Client->post('https://mandril...', Array)
#7 /project/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(85): Illuminate\Mail\Transport\MandrillTransport->send(Object(Swift_Message), Array)

8 /project/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(329): Swift_Mailer->send(Object(Swift_Message), Array)

#9 /project/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(151): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message))
#10 /project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(214): Illuminate\Mail\Mailer->send('emails.admin.ad...', Array, Object(Closure))
#11 /project/app/controllers/AdminController.php(261): Illuminate\Support\Facades\Facade::__callStatic('send', Array)
#12 /project/app/controllers/AdminController.php(261): Illuminate\Support\Facades\Mail::send('emails.admin.ad...', Array, Object(Closure))
#13 /project/app/controllers/AdminController.php(145): AdminController->updateUser(Object(User))
#14 [internal function]: AdminController->anyUserAction('[email protected]', 'update')
#15 /project/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#16 /project/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('anyUserAction', Array)
#17 /project/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(AdminController), Object(Illuminate\Routing\Route), 'anyUserAction')
#18 /project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AdminController', 'anyUserAction')
#19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}('[email protected]', 'update')
#20 /project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#21 /project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#22 /project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#23 /project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#24 /project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#25 /project/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#26 /project/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#27 /project/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#28 /project/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#29 /project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#30 /projectl/public/index.php(49): Illuminate\Foundation\Application->run()
#31 {main} [] []    

Also this is for Laravel 4.2. I can't use Laravel 5 yet (although I really want to use Laravel 5.1 LTS) as I have too little time to spend the time to migrate yet. Slowly getting it done though.