I set 'pretend' => true,
in the mail.php
,创建了这个new.php
view:
<body>
<div>
E-mail: {{ $user->email }}<br>
User: {{ $user->username }}<br>
Pass: {{ $user->password }}<br>
</div>
</body>
然后在我的控制器中,我使用此代码“发送”邮件:
$data['user'] = $user;
Mail::send('emails.new', $data, function($message) use ($user)
{
$message->to('examp[email protected] /cdn-cgi/l/email-protection', $user->username)->subject('Account');
});
日志文件中的输出仅是这样的:
[2013-08-30 11:27:56] log.INFO:假装将邮件发送至:[电子邮件受保护] /cdn-cgi/l/email-protection [] []
我尝试使用完整的 HTML 视图,也尝试使用另一个仅包含字符串、不包含变量的视图,但输出是相同的。
这应该是这样的吗?它不应该打印整个消息、标题等吗?代码有问题还是这是正确的输出?
如果你设置'pretend' => true
in app/config/mail.php
那么就不会发送任何邮件,您只会在日志中收到一条消息,如下所示:
[2014-07-17 14:15:07] production.INFO:
Pretending to mail message to: [email protected] /cdn-cgi/l/email-protection [] []
然而,如果你离开'pretend' => false
并使用log
司机 ('driver' => 'log'
,自 Laravel 4.2 起可用),然后您将把整个邮件内容写入日志,而不是发送邮件:
[2014-07-17 14:15:14] production.DEBUG:
Message-ID: <[email protected] /cdn-cgi/l/email-protection>
Date: Thu, 17 Jul 2014 14:15:15 +0000
Subject: Welcome!
From: Ahmad <[email protected] /cdn-cgi/l/email-protection>
To: John Smith <[email protected] /cdn-cgi/l/email-protection>
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Order confirmed!
[] []
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)