Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

richtestani's avatar

Url in email includes an ending curly bracket %7D

I have an email that is generated when a user registers or requests to resend their activation email.

The url in the email ends with the end }

Here is my Activation class

class Activation extends Mailable

{ use Queueable, SerializesModels;

public $activation;
public $username;
public $url;

/**
 * Create a new message instance.
 *
 * @return void
 */
public function __construct($user)
{
    //
    $this->activation = $user->activation_key;
    $this->username = $user->username;
    $this->url = route('user.activate', $user->activation_key);
}

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    \Log::info('EMAIL DELIVERY :: New Registration');
    return $this->view('mail.activation')
                ->from('[email protected]')
                ->subject('Activation');
}

}

And here is my template activation.blade.php

<html>
 <head>
<meta charset="utf-8">
<title></title>
</head>
 <body>
  <div class="container">
  <h2>Welcome {{$username}}</h2>
  <p>Thanks for joining.</p>
  <p>To finalize your account, just click the link below to activate it, and then you can post.
  </p>
  <p><a href="{{$url}}" style="padding: 10px; background-color: indianred; color: white;">Turn 
  Me On.</a></p>
 </div>
<footer></footer>
 </body>
</html>

The above, would give me a url like:

http://dpp.app/user/activation/8ff4013e-421b-11e7-97c8-08002732ed09%7D

The tail end includes the curly bracket. Anyone see why I am getting this?

Thanks Rich

0 likes
1 reply
ohffs's avatar

Maybe try using

{!! $url !!}

If that doesn't help, try dd'ing the $this->url inside the mailable before sending it just to check what it looks like outside of the view itself. If that still looks fine, maybe add a @php dd($url) @endphp block into the view itself and see.

Please or to participate in this conversation.