php - laravel4超链接没有显示在 yahoo,outlook中,但在gmail超链接中工作

  显示原文与译文双语对照的内容

我是 laravel4,我正在开发一个网站,并创建一个用户注册功能 successfully.After 。

除了Gmail外,应该显示为超链接的验证码不显示为超链接,即在其他电子邮件服务提供商如 yahoo 。outlook 。gmx中显示的。 验证代码未显示为超链接。 仅显示为纯文本。

这是我的mail.php 文件


<?php

return array(

/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's"mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported:"smtp","mail","sendmail","mailgun","mandrill","log"
|
*/

'driver' => 'smtp',

/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/

'host' => 'mail.forgroup.com',

/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/

'port' => 465,

/*
|--------------------------------------------------------------------------
| Global"From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/

'from' => array('address' => '******@*******.com', 'name' => '*******'),

/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/

'encryption' => 'ssl',

/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the"password" value below this one.
|
*/

'username' => '******',

/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/

'password' => '*******',

/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the"sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/

'sendmail' => '/usr/sbin/sendmail',

/*
|--------------------------------------------------------------------------
| Mail"Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/

'pretend' => false,

);

我不知道这个错误的原因,我尝试改变端口的端口值是 465,但是在更改端口值之后,我的端口值为 25,所以我返回到了以前的端口


Swift_TransportException
Connection could not be established with host mail.foragroup.com [ #0]

之后,我尝试了另一个加密"tls"而不是"ssl",但是之后,我遇到了以下错误


Swift_TransportException
Connection to tcp://mail.forgroup.com:465 Timed Out

现在虽然我没有明确的想法,我给你我的控制器,实际上我发送验证邮件,这里是控制器。


public function signupPost()
{
 $validator = Validator::make(Input::all(), array(

 'email' => 'required|max:255|email|unique:users',
 'username' => 'required|min:4|unique:users',
 'password' => 'required|min:8',
 'password_again' => 'required|same:password'

 )
 );

 if($validator->fails())
 {
 return Redirect::route('signup')
 ->withErrors($validator)
 ->withInput();
 }else
 {
 $email = Input::get('email');
 $username = Input::get('username');
 $password = Input::get('password');

//Activation Code
 $code = str_random(60);

 $user = User::create(array(
 'email' => $email,
 'username' => $username,
 'password' => Hash::make($password),
 'code' => $code,
 'active' => 0 
 )
 );

 if($user){
//User Activation Code Creation
 Mail::send('emails.auth.activate', array('link' => URL::route('activate-account',$code), 'username' => $username),function($message) use ($user)
 {
 $message->to($user->email,$user->username)->subject('Activate Your Account');
 });

 return Redirect::route('signup')
 ->with('global','Your Account has been created! We have sent you an email to activate your account.Please Check the both the Inbox and Spam Folder.');

 }

 }



}

更新

这是我的激活HTML文件


<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 <title></title>
</head>
<body>
<h3>Hello <strong><h1 style="color:#1B438D">{{$username}}</h1></strong></h3> <br><br>
 Please Activate Your Account Using The Following Link <br><br>

<b>NOTE</b><h3 style="color:red;">If the following code is not a link or clickable,then please <b>COPY</b><br/>
the whole code and <b>PASTE</b> it in NEW TAB of your browser.</h3> 


----
{{$link}}
----

</body>
</html>

时间:

根据你的情况,我不认为错误在 mail.php 中,否则,你将无法发送任何电子邮件。

我怀疑错误是在 email/auth/activate.blade.php

比较一下我的和你的差异。

下面是我的激活按钮样式,它是跨所有电子邮件客户端工作的。 我已经测试过 Google,Outlook 和更多。


<div style="font-family: Arial, sans-serif; color: #90bc26; font-size: 13px;">
 <a target="_blank" href="http://{{ str_replace("http://","",$link); }}" style="color: #ffffff; text-decoration: none; margin: 0px; text-align: center; vertical-align: baseline; border: 4px solid #90bc26; padding: 4px 9px; font-size: 15px; line-height: 21px; background-color: #90bc26;">&nbsp; Activate Now &nbsp;</a>
 </div>

替换你的激活按钮,让我知道它如何。"。"。

当我遇到那个问题时我记得。

...