title: Override Mail MailgunTransport class in Laravel 4.2
body: <p>Using mailgun as mail driver I am facing the problem that blind carbon copy is not working properly as it shows all the addresses to all the recipients. I found a fix that would solve the problem but it requires to edit the MailgunTransport.php file at vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php. I don't want to change a file on vendors folder so I am trying to extend that MailgunTransport class...</p>
  
  <p>I created a folder called app/custom/extensions with two files, CustomMailServiceProvider...</p>
  
  <pre><code>&lt;?php namespace custom\extensions;
  
  use Swift_Mailer;
  use Illuminate\Support\ServiceProvider;
  use Swift_SmtpTransport as SmtpTransport;
  use Swift_MailTransport as MailTransport;
  use Illuminate\Mail\Transport\LogTransport;
  use custom\extensions\CustomMailgunTransport;
  use Illuminate\Mail\Transport\MandrillTransport;
  use Swift_SendmailTransport as SendmailTransport;
  
  class CustomMailServiceProvider extends \Illuminate\Mail\MailServiceProvider {
  
  }
  </code></pre>
  
  <p>...and CustomMailgunTransport.php</p>
  
  <pre><code>&lt;?php namespace custom\extensions;
  
  class CustomMailgunTransport extends Illuminate\Mail\Transport\MailgunTransport {
      /**
       * {@inheritdoc}
       */
      public function send(Swift_Mime_Message $message, &amp;$failedRecipients = null)
      {        
          $client = $this-&gt;getHttpClient();
          $to = $this-&gt;getTo($message);
          $message-&gt;setBcc([]);
  
          $client-&gt;post($this-&gt;url, ['auth' =&gt; ['api', $this-&gt;key],
              'body' =&gt; [
                  'to' =&gt; $to,
                  'message' =&gt; new PostFile('message', (string) $message),
              ],
          ]);
      }
  }
  </code></pre>
  
  <p>CustomMailServiceProvider.php does not redefine any original methods but changes the call from the original MailgunTransport to custom\extensions\CustomMailgunTransport. </p>
  
  <p>I have loaded the app/custom/extensions directory of the new files at composer.json classmap...</p>
  
  <pre><code>{
      ...
      "autoload": {
          "classmap": [
              ...
              "app/custom/extensions"                
          ],       
      },
      ...
  }
  </code></pre>
  
  <p>And I have swapped the original 'Illuminate\Mail\MailServiceProvider' to 'custom\extensions\CustomMailServiceProvider'...</p>
  
  <pre><code>'providers' =&gt; array(
      ...
      //'Illuminate\Mail\MailServiceProvider',
      'custom\extensions\CustomMailServiceProvider',
      ...
  ),
  </code></pre>
  
  <p>However, at this point I don't know how to call the mail functionalities. If I try to use the Mail facade it uses the original code from MailgunTransport.php</p>
  
  <p>Do I need to create a custom facade? and if so... How can can I do it? Or is there any problem with the code above? Is there any way I could extend only the MailgunTransport.php without creating a CustomMailServiceProvider?</p>