Home >Backend Development >PHP Tutorial >[Mr. Mai] Implement email verification in the Laravel framework---send emails, laravel---_PHP tutorial
After using it for a period of time, I found that there are many places in the project User verification is required, with SMS verification and email verification being the mainstream trends. Xiaomai summarized how to implement SMS verification if the email sending function is implemented in the Laravel framework.
Under .env file
1. Configure Laravel files
MAIL_DRIVER=smtp //It is recommended to use smtp method
MAIL_HOST=smtp.163.com //It is recommended to use 163 mailbox, QQ mailbox will report an error
MAIL_PORT=25 //smtp default is 25
MAIL_USERNAME=null //My own 163 account
MAIL_PASSWORD=null //Client password
MAIL_ENCRYPTION=null
.
2. Modify
in the config/email.php file
'from' => Write your own 163 address
3. Register 163’s email address and set up your email account. Turn on POP3/SMTP/IMAP and enable the authorization code and perform mobile phone verification
4. Refer to the Laravel manual for sending emails
It must be noted that when the controller quotes the email to send, it must first quote use Mail
Send email test
Set in routing
Write the method in the controller
2.$message->subjuet(''); is the title of the file
through
This is a list of methods that can be used in
message generator instances:
$message