title: Connection could not be established with host free.mboxhosting.com [Connection refused #111] with laravel in free hosting
body: <p>I've been hosted my laravel project in a free hosting (in awardspace). Everything works ok, except sending email. When I try to send an email by compiling the form from the contact page of my project, it returns me this error: </p>
  
  <pre><code>Swift_TransportException
  Connection could not be established with host free.mboxhosting.com [Connection refused #111] 
  </code></pre>
  
  <p>This is the outgoing mail settings that free hosting service offers:</p>
  
  <p><a href="https://i.stack.imgur.com/kO8bb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kO8bb.jpg" alt=""></a></p>
  
  <p>This is how i've been set the file .env</p>
  
  <pre><code>MAIL_DRIVER=smtp
  MAIL_HOST=free.mboxhosting.com
  MAIL_PORT=465
  MAIL_USERNAME=contatti@pprivitera.dx.am
  MAIL_PASSWORD=mypassword
  MAIL_ENCRYPTION=ssl
  MAIL_FROM_ADDRESS=contatti@pprivitera.dx.am
  MAIL_FROM_NAME=User
  </code></pre>
  
  <p>And this is how I've been set the config/mail.php file</p>
  
  <pre><code>'driver' =&gt; env('MAIL_DRIVER', 'smtp'),
  'host' =&gt; env('MAIL_HOST', 'free.mboxhosting.com'),
  'port' =&gt; env('MAIL_PORT', 465),
  'from' =&gt; [
      'address' =&gt; env('MAIL_FROM_ADDRESS', 'contatti@pprivitera.dx.am'),
      'name' =&gt; env('MAIL_FROM_NAME', 'User'),
  ],
  'encryption' =&gt; env('MAIL_ENCRYPTION', 'ssl'),
  'username' =&gt; env('contatti@pprivitera.dx.am'),
  'password' =&gt; env('mypassword')
  </code></pre>
  
  <p>Tests I did:</p>
  
  <p>1)I tried to change <code>MAIL_DRIVER</code> from <code>"smtp"</code> to <code>"sendmail"</code> both from .env file and from the mail.php file, but it doesn't work because the website after 4 minutes of loading returns me: <code>The GET method is not supported for this route. Supported methods: POST</code> (I don't understand why, because in local the contact form works perfectly and anyway the Route <code>/contact/submit</code> is set as <code>::post</code> and the method of my contact form is set as <code>"=post"</code> too)</p>
  
  <p>2)I tried to change the <code>MAIL_ENCRYPTION</code> from <code>"ssl"</code> to <code>"null"</code> so I've changed also the port from <code>465</code> to <code>25</code> or <code>587</code> (both from .env file and from the config/mail.php file) but it returns me the error <code>([Connection refused #111])</code></p>
  
  <p>3)I tried to use mailtrap with my credential, both with <code>ssl</code> encryption and with <code>null</code> encryption, using 2525 port or 465 (depend from encryption type used), but it returns me the same error: </p>
  
  <pre><code>Connection could not be established with host smtp.mailtrap.io [Connection refused #111]
  </code></pre>
  
  <p>4)With mailtrap if I change the <code>MAIL_DRIVER</code> from <code>smtp</code> to <code>sendmail</code>, it returns me the error that I've described in the 1st point</p>
  
  <p>5)In my local machine everything works perfectly, just using mailtrap with <code>MAIL_DRIVER</code> set as <code>smtp</code> and the rest of configuration set with credential of my mailtrap account</p>
  
  <p>I don't understand what's wrong in the configuration. Thanks for the help!</p>