i am new in laravel4,i am developing a website and create an user registration functionality successfully.After a registration,the certain user will get an email for account activation,which is absolutely working fine in my web app.
我是laravel4的新用户,我正在开发一个网站并成功创建用户注册功能。注册后,某个用户将收到一个帐户激活的电子邮件,这在我的网络应用程序中绝对正常。
but the problem is , the verification code which should be appear as a hyperlink,not appearing as a hyperlink except Gmail,that is,in other email service provider like yahoo,outlook,GMX... that verification code is not appearing as hyperlink.. only appearing as a plain text.
但问题是,验证码应该显示为超链接,不显示为除Gmail以外的超链接,即在其他电子邮件服务提供商中,如yahoo,outlook,GMX ......验证码不会显示为超链接。只出现在纯文本中。
now here is my mail.php file
现在这是我的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,
);
though i have no idea,whats the reason for this error,i have tried to change the port in my mail.php file.Previously my port value was 465,after changing it to 25,i am getting the following error,so i have get back to my previous port which is 465
虽然我不知道,这是错误的原因,我试图更改我的mail.php文件中的端口。以前我的端口值是465,更改为25后,我得到以下错误,所以我有回到我以前的465港口
Swift_TransportException
Connection could not be established with host mail.foragroup.com [ #0]
after that i have tried the another encryption "tls" instead of "ssl",but after that i am facing the following error
之后我尝试了另一个加密“tls”而不是“ssl”,但之后我面临以下错误
Swift_TransportException
Connection to tcp://mail.forgroup.com:465 Timed Out
now though i have no clear idea,i am giving you my controller by which actually i am sending the verification mail,here is the controller
现在虽然我没有明确的想法,我给你我的控制器实际我发送验证邮件,这是控制器
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.');
}
}
}
UPDATE
This is the my activate HTML file
这是我激活的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>
1 个解决方案
#1
0
According to your situation, I don't think that the error is in mail.php
, otherwise, you won't be able to sent out any email.
根据你的情况,我不认为错误是在mail.php中,否则,你将无法发送任何电子邮件。
I suspect the error is in email/auth/activate.blade.php
我怀疑错误发生在email / auth / activate.blade.php中
Compare mine with your and note the diff.
将我与你的比较并注意差异。
Here is how I style my activation button, and it's work across all the email clients. I've already tested with Google, Outlook, and more.
以下是我为激活按钮设置样式的方法,它适用于所有电子邮件客户端。我已经使用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;"> Activate Now </a>
</div>
Replace your activate button with mine, and let me know how it go ...
用我的激活按钮替换,让我知道它是怎么回事......
I remembered when I came across that problem.
我记得当我遇到这个问题时。
#1
0
According to your situation, I don't think that the error is in mail.php
, otherwise, you won't be able to sent out any email.
根据你的情况,我不认为错误是在mail.php中,否则,你将无法发送任何电子邮件。
I suspect the error is in email/auth/activate.blade.php
我怀疑错误发生在email / auth / activate.blade.php中
Compare mine with your and note the diff.
将我与你的比较并注意差异。
Here is how I style my activation button, and it's work across all the email clients. I've already tested with Google, Outlook, and more.
以下是我为激活按钮设置样式的方法,它适用于所有电子邮件客户端。我已经使用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;"> Activate Now </a>
</div>
Replace your activate button with mine, and let me know how it go ...
用我的激活按钮替换,让我知道它是怎么回事......
I remembered when I came across that problem.
我记得当我遇到这个问题时。