- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
谁能帮我 Laravel 邮件功能 ?
我改了 config/mail.php 归档到
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'mail.concept.kz'),
'port' => env('MAIL_PORT', 25),
'from' => ['address' => 'support@concept.kz', 'name' => 'asdf'],
'encryption' => env('MAIL_ENCRYPTION', null),
'username' => env('support@concept.kz'),
'password' => env('mypassword'),
'sendmail' => '/usr/sbin/sendmail -bs',
Mail::raw($messageBody, function($message) {
$message->from('support@concept.kz', 'Learning Laravel');
$message->to('receiver@mail.ru');
});
if (Mail::failures()) {
echo 'FAILED';
}
return redirect()->back();
最佳答案
从您的网站发送电子邮件
{!! Form::Open(['url' => 'sendmail']) !!}
<div class="col_half">
{!! Form::label('name', 'Name: ' ) !!}
{!! Form::text('name', null, ['class' => 'form-control', 'required']) !!}
</div>
<div class="col_half col_last">
{!! Form::label('email', 'E-Mail: ' ) !!}
{!! Form::email('email', null, ['class' => 'form-control', 'required']) !!}
</div>
<div class="clear"></div>
<div class="col_full col_last">
{!! Form::label('subject', 'Subject: ' ) !!}
{!! Form::text('subject', null, ['class' => 'form-control', 'required']) !!}
</div>
<div class="clear"></div>
<div class="col_full">
{!! Form::label('bodymessage', 'Message: ' ) !!}
{!! Form::textarea('bodymessage', null, ['class' => 'form-control', 'required', 'size' => '30x6']) !!}
</div>
<div class="col_full">
{!! Form::submit('Send') !!}
</div>
{!! Form::close() !!}
public function sendMail(Request $request) {
//dd($request->all());
$validator = \Validator::make($request->all(), [
'name' => 'required|max:255',
'email' => 'required|email|max:255',
'subject' => 'required',
'bodymessage' => 'required']
);
if ($validator->fails()) {
return redirect('contact')->withInput()->withErrors($validator);
}
$name = $request->name;
$email = $request->email;
$title = $request->subject;
$content = $request->bodymessage;
\Mail::send('emails.visitor_email', ['name' => $name, 'email' => $email, 'title' => $title, 'content' => $content], function ($message) {
$message->to('your.email@gmail.com')->subject('Subject of the message!');
});
return redirect('contact')->with('status', 'You have successfully sent an email to the admin!');
}
<p>Name: {{ $name }}</p>
<p>E-Mail: {{ $email }}</p>
<p>Subject: {{ $title }}</p>
<p>Message: <br>
{{ $content }}</p>
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your.email@gmail.com
MAIL_PASSWORD=email-password
MAIL_ENCRYPTION=tls
关于php - Laravel 发送邮件 SMTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39838646/
大家好,我是 php 和 html 新手,面临问题:SMTP 错误:无法连接到 SMTP 主机。邮件程序错误:SMTP 错误:无法连接到 SMTP 主机。但在本地 xampp 中工作正常,在服务器中出
我希望这个问题不是完全偏离主题。 我一直想知道 SMTP 电子邮件验证。有很多服务(例如 Kickbox.io、Email-Validator.net 等)似乎可以处理 SMTP 验证,而不会阻止其
我正在尝试使用 phpMailer 通过电子邮件向用户发送确认消息。我的代码是这样的: IsSMTP(); // set mailer to use SMTP $mail->Host = "ssl:/
我已经在我的本地机器(Windows 7)上安装了 bugzilla 并且它运行良好。但是当我尝试创建一个新帐户时,它说 There was an error sending mail from it
我有一个将发送大量输出的程序。我只是想知道最大电子邮件附件大小是多少?根据RFC 1870邮件服务器可以拒绝邮件,因为它们太大了,但是使用 SMTP/MIME 时有最大大小吗?我在这方面找不到任何东西
假设我有一个网站,其某些功能需要电子邮件验证(例如用户注册)。当然,我会使用正则表达式验证电子邮件,但曾几何时,我在其他人的代码中看到了 SMTP 验证。 SMTP 验证有哪些优点和缺点? 我可以假设
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 2年前关闭。 Improve thi
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我正在尝试使用 Vala 和 GLib + GIO 实现一个简单的 SMTP 服务器。 到目前为止,纯文本通信没有问题,但当涉及使用 STARTTLS 的 TLS 时,事情会变得更加困难。 这是我到目
我使用 go 的 net/smtp 发送电子邮件,它对某些电子邮件工作正常但对其他电子邮件无效。我收到 554 5.5.1 Error: no valid recipients 但我很确定我提供了正确
我需要帮助 这是我的代码: require 'PHPMailerAutoload.php'; $mail = new PHPMailer; $mail->isSMTP(); $mail->Host =
我的 joomla 联系表 gmail SMTP 设置不起作用。请参阅下面提交联系表时显示的消息。应该是什么原因?extension=php_openssl.dll 也启用了.. 错误信息-: SMT
我正在尝试使用 Amazon 的 SES/SMTP 发送电子邮件,但出现以下错误: javax.mail.MessagingException:无法连接到 SMTP 主机:email-smtp.us-
在我的Mac终端上,我试图通过telnet将smtp.gmail.com转换为port 587。 在Google Apps(设置为管理Dreamhost域)上,我已配置了中继,如下所示: "Allow
理论上,Request For Comments (RFC) 集包含开发人员构建 SMTP 客户端需要知道的一切。然而,要知道哪些 RFC 需要考虑,哪些可以忽略并不总是那么容易。 有没有人有 RFC
MT 支持 SMTP SendMail,还是我坚持使用 MFMailComposeViewController?现在,我可以使用它(MFMailComposeViewController),但是当我添
很难说出这里问的是什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或言辞激烈,无法以目前的形式合理回答。如需帮助澄清此问题以便可以重新打开,visit the help center . 10年前关
我正在尝试通过 BizTalk SMTP 发送端口发送消息。具体来说,我正在通过编排的“稍后指定”端口发送消息。我的目标是使用我选择的附件文件名将消息正文附加到已发送的电子邮件。 但是,无论我尝试什么
我正在编写一个通过有效的 GMail 用户 ID 和密码发送邮件的应用程序。 我只是想在 Windows XP 命令行上模拟 SMTP 连接,当我在 465 端口 telnet smtp.gmail.
关于从应用程序通过 GMails SMTP 服务器发送的电子邮件被标记为垃圾邮件的问题已经有很多讨论。 阅读其他帖子我无法弄清楚我的问题。我的电子邮件最终仍然是 SPF 中性的。 在我的 *(捕获所有
我是一名优秀的程序员,十分优秀!