title: Laravel 5.1 sending email error : stream_set_blocking() expects parameter 1 to be resource, null given
body: <p>I am using Laravel 5.1 , I want to send email (smtp)
  this is my <code>.env</code> config :</p>
  <pre><code>MAIL_DRIVER=smtp
  MAIL_HOST=mail.mydomain.ir
  MAIL_PORT=587
  MAIL_USERNAME=account@mydomain.ir
  MAIL_PASSWORD= ....
  MAIL_ENCRYPTION=null
  </code></pre>
  <p>and this in <code>config/mail.php</code>  :</p>
  <pre><code>'from' =&gt; ['address' =&gt;env('MAIL_USERNAME', 'account@mydomain.ir'), 'name' =&gt; 'ESET'],
  </code></pre>
  <p>and a test function to send an simple test email :</p>
  <pre><code>public function getEm()
  {
      $input = [] ;
      Mail::send('emails.simple', $input, function($message) {
              $message-&gt;to('some@gmail.com', 'Learning')-&gt;subject('Contact view Our Contact Form');
      });
      return 'Your message has been sent';
  }
  </code></pre>
  <p>and when I test this  project in localhost ( in WampServer) I works good and sends email ok !</p>
  <p>But when I want to use it in server(online) I will change my <code>.env</code> config as my host support says like this  :</p>
  <pre><code>MAIL_DRIVER=smtp
  MAIL_HOST=localhost
  MAIL_PORT=587
  MAIL_USERNAME=account@mydomain.ir
  MAIL_PASSWORD=....
  MAIL_ENCRYPTION=null
  </code></pre>
  <p>I See this error :</p>
  <blockquote>
  <p>ErrorException in StreamBuffer.php line 275:</p>
  <p>stream_set_blocking() expects parameter 1 to be resource, null given</p>
  <p>in StreamBuffer.php line 275 at HandleExceptions-&gt;handleError('2',
  'stream_set_blocking() expects parameter 1 to be resource, null
  given',
  '/home2/net45987/domains/esetn32.ir/public_html/la/user/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php',
  '275', array('host' =&gt; 'localhost', 'timeout' =&gt; '30', 'options' =&gt;
  array(), 'streamContext' =&gt; resource, 'errno' =&gt; null, 'errstr' =&gt;
  null)) at stream_set_blocking(null, '1') in StreamBuffer.php line 275
  at Swift_Transport_StreamBuffer-&gt;_establishSocketConnection() in
  StreamBuffer.php line 62 at
  Swift_Transport_StreamBuffer-&gt;initialize(array('protocol' =&gt; null,
  'host' =&gt; 'localhost', 'port' =&gt; '587', 'timeout' =&gt; '30', 'blocking'
  =&gt; '1', 'tls' =&gt; false, 'type' =&gt; '1', 'stream_context_options' =&gt; array())) in AbstractSmtpTransport.php line 113 at
  Swift_Transport_AbstractSmtpTransport-&gt;start() in Mailer.php line 79
  at Swift_Mailer-&gt;send(object(Swift_Message), array()) in Mailer.php
  line 395 at Mailer-&gt;sendSwiftMessage(object(Swift_Message)) in
  Mailer.php line 181 at Mailer-&gt;send('emails.simple', array(),
  object(Closure)) in Facade.php line 222 at
  Facade::__callStatic('send', array('emails.simple', array(),
  object(Closure))) in CallbackController.php line 114 at
  Mail::send('emails.simple', array(), object(Closure)) in
  CallbackController.php line 114 at CallbackController-&gt;getEm()</p>
  </blockquote>