# Mail Configuration

BeikeShop emails can be configured in Backstage-System Settings-Email Settings

img.png

The mail engines supported by BeikeShop are: SMTP, Sendmail, Mailgun

Note: The email address in the BeikeShop backend system settings-basic settings must be consistent with the user in the email settings

# QQ Mail

Enter QQ mailbox, click "Settings-Account"

img.png

Enable POP3/SMTP service, click the arrow to view the format, and generate the authorization code:

img.png

img.png

Get the SMTP server and port. Each mailbox has a different SMTP server.

img.png

Email configuration:

Enter BeikeShopBackstage-System Settings-Email Settings,select the email engine: SMTP, and fill in the following information in sequence

Host: smtp.qq.com

User: QQ mailbox

Password: Authorization code

Port: 465

Save after configuration

img.png

Note: The email address in the BeikeShop backend system settings-basic settings must be consistent with the user in the email settings

# 163Mailbox

Enter 163 mailbox. Click Settings-POP3/SMTP/IMAP

img.png

Enable POP3/SMTP service and generate authorization code

img.png

Get the SMTP server, the port is usually 465, except for special emails!

img.png

Email configuration:

Enter BeikeShopBackstage-System Settings-Email Settings, select the email engine: SMTP, and fill in the following information in sequence

Host: smtp.163.com

User: 163 mailbox

Password: Authorization code

Port: 465

Save after configuration

img.png

Note: The email address in the BeikeShop backend system settings-basic settings must be consistent with the user in the email settings.

# Gmail

Gmail are not applicable in China and will be directly rejected by Google.

Official reference document for Google mailboxes: https://support.google.com/mail/answer/7126229?visit_id=637245836154040494-1719467026&hl=zh-Hans&rd=1

First, you need to apply for a Google mailbox. The specific application steps will not be explained.

Set a dedicated SMTP password, https://security.google.com/settings/security/apppasswords

img.png

Email configuration:

Enter BeikeShopBackstage-System Settings-Email Settings, select the email engine: SMTP, and fill in the following information in sequence

Host: smtp.gmail.com

User: gmail mailbox

Password: gmail application-specific password

Port: 465

Save after configuration

img.png

Note: The email address in the BeikeShop backend system settings-basic settings must be consistent with the user in the email settings

# Queue Configuration

Enable the queue to process mail tasks. The configuration steps are as follows:

img.png

1.Configuring a database driver to handle queues

(1)In the .env file, set the queue driver to database

QUEUE_CONNECTION=database

(2)Execute the command to create the table(failed_jobs、jobs)

php artisan queue:table

php artisan migrate

These two commands will create the jobs table for storing queue tasks and the failed_jobs table for storing failed tasks respectively.

(3)Confirm that other parameters of the email have been configured (refer to email configuration)

(4)Execute the command to enable queue monitoring

php artisan queue:work -v

2.Dealing with Common Problems

(1)View related tables failed_jobs, jobs, and notifications (You can use database management tools to view the data in these tables.)

(2)View the console output information (When executing the php artisan queue:work -v command, the console will output the execution process of the task. If there is a problem, it will display error information to help you diagnose the problem during the task processing.)

3.Other queue drivers (such as Redis) can be configured

4.In a production environment, you need a way to keep queue:work processes running. queue:work processes can stop running for a variety of reasons, such as exceeding a worker timeout or executing a queue:restart command. For this reason, you need to configure a process monitor that can detect when your queue:work processes exit and automatically restart them. In addition, a process monitor allows you to specify how many queue:work processes to run simultaneously. Supervisor is a commonly used process monitor in Linux environments. The configuration method can refer to the following document. https://learnku.com/docs/laravel/10.x/queues/14873#e45763 (opens new window)

# Email Configuration FAQ

1.How to change the sender of an email?

img.png

A: Modify the APP_NAME in the .env file in the root directory of the website

img.png

2.Registered user error: "Server Error"

img.png

Open the website debug, then register to see the error message [.env file in the website root directory APP_DEBUG=true]

The following error message appears:

img.png

A: The email address in the BeikeShop backend system settings-basic settings needs to be consistent with the user in the email settings.

img.png

The following error message appears:

img.png

A: (1) Check whether the SMTP server address or port is filled in correctly; (2) Check your server network, or whether the server has any restrictions on the port.

3.The user registration was successful, but no email was received

A:
(1)Check whether the queue is used. If the queue is used, you need to enable queue monitoring and check whether there is a failure (FAIL) message returned.

Execute the command to enable queue monitoring
php artisan queue:work -v 

(2)Disable the queue, turn on debug, and then register to view the error message to check the problem