Search code examples
phpemaillaravel-5mailgun

Mailgun changed links in my email


I'm using the php framework Laravel to send emails with mailgun to a certain list. The emails get delivered all the links got changed to email.mg.mydomain/c/.... for some reason everything is fine in the view i sent. After sending some emails there were alot of drops and bounces from mailgun so my domain got disabled - could this be the reason? I use open and click tracking.

Here is my code for sending

$client = new \Http\Adapter\Guzzle6\Client();

$mgClient = new Mailgun('key-notmyrealkey', $client);
$result = $mgClient->sendMessage($domain, array(
                'from' => 'Sender <[email protected]>',
                'to' =>  $mail ,
                'subject' => 'Sender',
                'html' => view('some_view'),
            ));

Solution

  • This behavior is exactly what click tracking does - it re-writes the URLs for each outgoing email so that Mailgun can track independent clicks and associate them with a specific email. This is why the Domain Verification & DNS part of the Mailgun setup on your domain involved setting up the "email." sub-domain as a CNAME pointing to mailgun.org.