6ber6ou's avatar

mailto and HTML

Hi all.

When I use mailto the HTML is transformed, is it possible to avoid that ?

For example hello is transformed in <<>span<>>

0 likes
10 replies
MThomas's avatar

I guess this is the famous issue with escaping html in L5 :)

Try:

{!! HTML::mailto('someone@example.com') !!}

But why not just write the html yourself? I don't see the benefit in using the HTML facade? It just makes your views mutch more unreadable imho.

<a href="mailto:someone@example.com">someone@example.com</a>
6ber6ou's avatar

Yes I use the mailto facade because laravel crypt the email address. I use L4 so I will escape the string with {{{ ... }}} Thanks :)

bashy's avatar

There shouldn't be a need to use {{{ or {!! to escape it? What are you trying to put in the mailto() part? :/

6ber6ou's avatar

I try to put I I want to put a text with a bootstrap icon in a span tag

bashy's avatar

@MThomas Yeah handy to stop bots seeing it (not sure how basic it is though).

@6ber6ou Yeah the thing is, it puts it all into the a href link so you'll find it will add span and class stuff into the email? These are the only things you can put into it

HTML::mailto($email, 'title', $attributes);
// Obfuscate an e-mail address to prevent spam-bots from sniffing it
6ber6ou's avatar

Do you know which method is called to obfuscates the email ? May be I can manually call this method without use mailto.

Please or to participate in this conversation.