Laravel - 电子邮件中的激活链接未显示为链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25523147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel - activation link in email doesn't appear as link
提问by Goro
I have registration form with activation. So the user register his accoount then he receive email with link to activate his account. The problem is that the link is appear in the email like text not like URL. What can be the problem? Here is activate.blade.php
我有激活的注册表。因此,用户注册他的帐户,然后他会收到带有链接的电子邮件以激活他的帐户。问题是链接出现在电子邮件中,就像文本而不是 URL。可能是什么问题?这里是activate.blade.php
Hello {{ $username }}<br><br>
Please activate your account using the following link<br><br>
---<br>
{{ $link }} <br>
---
And here is the AccountControllermail send
这是AccountController邮件发送
Mail::send('emails.auth.activate', array(
'link' => URL::route('account-activate', $code),
'username' => $username),
function($message) use ($user) {
$message->to($user->email, $user->username)->subject('Activate your account');
});
回答by Damien Pirsy
Because you need to create an html link, if you want it to be clickable:
因为你需要创建一个html链接,如果你想让它可以点击:
Hello {{ $username }}<br><br>
Please activate your account using the following link<br><br>
---<br>
<a href="{{$link}}">{{$link}}</a><br>
Although some email clients already do that automatically, I think.
我认为,虽然一些电子邮件客户端已经自动做到了这一点。
URL::route('account-activate', $code)
creates only the url, not the link.
URL::route('account-activate', $code)
只创建 url,而不是链接。