Using SMTP authentication to send email through WordPress
Using SMTP authentication is generally a good idea when sending emails. Authenticating with the server will resolve problems like sending your message with an outbound spam mark. We’ll go over how to set up SMTP authentication in WordPress in this article. The WP SMTP plugin is used in this guide.
Steps to install the WP SMTP plugin:
Step 1: Log in to WordPress as admin.

Step 2: You will get the WordPress dashboard.

Step 3: On the left side go to Plugins and click on Add New option.

Step 4: On the right side you will get a search box in that, search for WP SMTP and hit enter.

Step 5: Now you can see a list of search results. To install it, click on the Install Now button.

Step 6: After completing the installation make sure to click on Activate Plugin to activate it.

Steps to configure the WP SMTP plugin:
To start with,
Step 1: On the left side of the navigation menu, click on Settings, and select WP SMTP.

Step 2: On the right side you will get SMTP settings.

Step 3: In these settings, fill all the information with actual details. Make sure to set SMTP Authentication to Yes.

Step 4: After filling the above information, click on the Save Changes button.

Step 5: If you want to test your settings, you may go to the send a test email section and enter an email address on which you want to send an email, enter a subject, message, and click on Send Test button.

You have now successfully configured WordPress to use SMTP authentication for sending mail on the server.
Related: Send Email From a PHP Script Using SMTP Authentication