search
HomeBackend DevelopmentPHP TutorialDetailed explanation of laravel5.4 using 163 mailbox to send emails

Sending emails is an essential requirement that we encounter in daily development. The following article mainly introduces you to the steps of using laravel5.4 to send emails using the 163 mailbox. The article introduces it through sample codes and pictures. Very detailed, friends in need can refer to it. I hope to be helpful.

Preface

In fact, sending an email is not difficult, rather it is quite simple. This article will introduce in detail about laravel5.4 using 163 email to send The relevant content of the email is shared for everyone’s reference and study. I won’t go into details below, let’s take a look at the detailed introduction.

1. First, register an account with 163 now and set it up as shown below


##The authorization code is very important. Please remember it carefully. You will configure it in laravel’s .env later~~


2. If you have done all the above, then the next step is to configure the .env

MAIL_DRIVER=smtp

MAIL_HOST=smtp.163.com

MAIL_PORT=465

MAIL_USERNAME=你的账号@163.com

MAIL_PASSWORD=你的客户端授权密码

MAIL_FROM_ADDRESS=你的账号@163.com

MAIL_FROM_NAME=账号名

MAIL_ENCRYPTION=ssl

3. Then the next step is to configure routing and write and send emails on the controller The method

Route::get('mail/send','CommonController@send');

Just write this send method on any controller:

public function send()

{

$name='学院君';

$flag= Mail::raw('你好,我是PHP程序!',function($message) {

$to='你的qq邮箱@qq.com';

$message->to($to)->subject('纯文本信息邮件测试');

});

if(!$flag){

echo '发送邮件成功,请查收!';

}else{

echo '发送邮件失败,请重试!';

}

//以上是纯文本,下面则是附带文件发送

//  $flag = Mail::send('emails.test',['name'=>$name],function($message){

//   $to = '你的qq邮箱@qq.com';

//   $message->to($to)->subject('text');

//   // $filePath = 'storage/exports/'.iconv('UTF-8', 'GBK', '学生成绩').'.xls';

//   $attachment = storage_path('app/files/test.txt');

//   //在邮件中上传附件

//   $message->attach($attachment,['as'=>'text.txt']);

//  });

//下面是发送邮件附带图片的

//  $imgPath = 'http://laravelacademy.org/wp-statics/images/carousel/LaravelAcademy.jpg';

//  $flag = Mail::send('emails.test',['name'=>$name,'imgPath'=>$imgPath],function($message){

//   $to = '你的qq邮箱@qq.com';

//   $message ->to($to)->subject('网络图片测试');

//  });

//  if(!$flag){

//   echo '发送邮件成功,请查收!';

//  }else{

//   echo '发送邮件失败,请重试!';

//  }

}

Okay, the next step is to access the route yourself and you will be able to get it. The desired result~~~~~

PS:The key point is to get the error reporting process. Basically, if you follow the steps, nothing will happen. It's a big problem, but the most important thing is that I used Ubuntu16.04 system to do it. The permission problem should be solved first, so I suggest giving permission first and opening the command line in your directory. :sudo chmod 777 -R ./

Okay, the next step is to solve the problem of not being able to connect to the 163 NetEase mailbox. The method I can give is line 263 of StreamBuffer.php Add two lines of code:

$options['ssl']['verify_peer'] = FALSE;

$options['ssl']['verify_peer_name'] = FALSE;

Basically follow the above steps and you can get it~~~

Related recommendations:

Detailed explanation of Laravel’s localization module

Detailed explanation of how to rewrite resource routing in Laravel

A brief analysis of Laravel’s late static binding

The above is the detailed content of Detailed explanation of laravel5.4 using 163 mailbox to send emails. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
mail.ru是什么邮箱mail.ru是什么邮箱Feb 05, 2024 pm 05:10 PM

mail.ru邮箱是俄罗斯地区的用户经常是使用的,有很多的国内的用户比较好奇了mail.ru是什么邮箱呢?现在就来看一下小编给大家带来的mail.ru邮箱介绍吧。mail.ru是什么邮箱答案:来自俄罗斯的邮箱服务。1、mail.ru邮箱网页版地址:https://mail.ru/;2、我们进入到mail.ru邮箱网页版的首页页面中我们可以在左侧看到有【@mail】点击;3、然后点击过后就会来到mail.ru邮箱的登录页面中来,在这里我们输邮箱地址之后,即可登录邮箱,如果没有账号的话点击【Crea

PHP 邮箱开发:构建高效的邮件发送系统PHP 邮箱开发:构建高效的邮件发送系统Sep 12, 2023 pm 05:55 PM

在当今互联网时代,电子邮件依然是人们最常用的沟通工具之一。无论是个人还是企业,都需要一个高效可靠的邮件发送系统。PHP作为一种广泛使用的编程语言,在开发邮件发送系统方面具有很大的优势。本文将介绍如何使用PHP构建一个高效的邮件发送系统。首先,我们需要配置PHP环境。确保服务器上已经安装了PHP,并且启用了相关的扩展模块,如mbstring、op

WhatsApp技巧:发送高清照片和视频的方法WhatsApp技巧:发送高清照片和视频的方法Sep 10, 2023 am 10:13 AM

WhatsApp推出了一个新选项,允许用户通过消息传递平台以高分辨率发送照片和视频。继续阅读以了解它是如何完成的。WhatsApp发布了一个更新,允许iPhone和Android用户以高分辨率发送照片和视频,最终解决了该服务的低质量媒体共享限制。该选项称为“高清质量”,意味着用户可以以最小的压缩发送更清晰的照片和视频。例如,在iPhone上捕获的图像现在可以以3024x4032分辨率发送,而不是以前的最大920x1280分辨率,而视频可以以1280×718分辨率发送,而不是848×476分辨率。

抖音上如何发给别人文件?上发给别人文件怎么删除?抖音上如何发给别人文件?上发给别人文件怎么删除?Mar 22, 2024 am 08:30 AM

在抖音上,用户不仅可以分享自己的生活点滴和才艺,还可以和其他用户互动交流。在这个过程中,有时候我们需要向其他用户发送文件,比如图片、视频等。那么,在抖音上如何发给别人文件呢?一、抖音上如何发给别人文件?1.打开抖音,进入你想要发送文件的聊天界面。2.点击聊天界面中的“+”号,选择“文件”。3.在文件选项中,你可以选择发送图片、视频、音频等文件。选择你想要发送的文件后,点击“发送”。4.等待对方接受你的文件,一旦对方接受,文件就会传输成功。二、抖音上发给别人文件怎么删除?1.打开抖音,进入你发送文

Python自动化办公小程序:实现报表自动化和自动发送到目的邮箱Python自动化办公小程序:实现报表自动化和自动发送到目的邮箱Apr 11, 2023 pm 11:49 PM

大家好!我是虎哥。项目背景作为数据分析师,我们需要经常制作统计分析图表。但是报表太多的时候往往需要花费我们大部分时间去制作报表。这耽误了我们利用大量的时间去进行数据分析。但是作为数据分析师我们应该尽可能去挖掘表格图表数据背后隐藏关联信息,而不是简单的统计表格制作图表再发送报表。一、报表自动化目的1.节省时间,提高效率自动化总是能够很好的节省时间,提高我们的工作效率。让我们的程序编程尽可能的降低每个功能实现代码的耦合性,更好的维护代码。这样我们会节省很多时间让我们有空去做更多有价值有意义的工作。2

企业微信的邮箱怎么登陆企业微信的邮箱怎么登陆Mar 10, 2024 pm 12:43 PM

企业微信的邮箱怎么登陆?企业微信APP中是可以登陆邮箱,但是多数的用户不知道邮箱如何的登陆,接下来就是小编为用户带来的企业微信邮箱登陆方法图文教程,感兴趣的用户快来一起看看吧!企业微信使用教程企业微信的邮箱怎么登陆1、首先打开企业微信APP,进入到主页面最底部【工作台】点击来专区;2、之后在工作台专区中,选择其中的【企业邮箱】服务;3、然后跳转到企业邮箱功能页,点击底部的【绑定】或者【换一个邮箱】;4、最后在下图所示的页面输入【QQ账号】和【密码】即可登陆邮箱。

一个手机号最多有几个163邮箱一个手机号最多有几个163邮箱Jun 08, 2023 am 10:29 AM

一个手机号最多有1个163邮箱,因为在创建163邮箱时,需要绑定一个有效的手机号,该手机号会被认证并作为账户的一部分进行记录,如果您希望创建另一个163邮箱,则需要另外一个未曾用于绑定其他163邮箱的不同手机号来进行认证。

邮箱地址是什么怎么填邮箱地址是什么怎么填Mar 12, 2024 pm 02:58 PM

1、电子邮件地址的格式是【用户名@域名】,其中用户名是收件人的账号,域名是收件人的电子邮件服务器的名称。2、例子【123456@qq.com】就是一个电子邮件地址,其中【123456】是用户名,【qq.com】是域名。3、再举个例子【888888@163.com】,其中【888888】是用户名,【163.com】是域名。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software