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

ronon's avatar
Level 9

Inline link in mail markdown message

Is it possible to print a inline link with laravels mail markdown?


class TicketNewReply extends Mailable
{
    use Queueable, SerializesModels;

...stuff

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this
                    ->subject('New reply ' . $this->reply->subject)
                    ->markdown('emails.ticket_new_reply');
    }
}

ticket_new_reply

@component('mail::message')
    Great you received a new answer.

Please press the following link to view it.
    <a href="{{ $url }}">{{ $url }}</a>

@endcomponent

I always receive plain html. How can i insert a link and not a button in a floating text with markdown? Tried [link] http://my.link but didn't worked.

0 likes
5 replies
Snapey's avatar

This works for me;

[This is the text that the user sees]({{ $url }})

but it should be entered pinned next to the left margin and the Link will also be justified left

1 like
ronon's avatar
Level 9

Now I'm confused. I have more text in the markdown like

# Header

body text

The body text is wrapped in a pre>code . If I remove the header line it get's printed correctly and the links are also rendered

ronon's avatar
ronon
OP
Best Answer
Level 9

I found my issue. If you want to use markdown don't intend the lines for better readability

DON'T

@component('mail::message')
    Great you received a new answer.

   Please press the following link to view it.
    <a href="{{ $url }}">{{ $url }}</a>

@endcomponent

DO

@component('mail::message')
  
Great you received a new answer.

Please press the following link to view it.
a href="{{ $url }}">{{ $url }}</a>

@endcomponent

Snapey's avatar

Thats what I meant by pinned to the left margin....

Please or to participate in this conversation.