How to send Email in WordPress?

 

What is WordPress?

 

WordPress is a tool where you can create a website online in PHP. And is also an open source.

WordPress is a simplest and strongest blogging and site content management system which is used commonly today.

WordPress will be built with PHP and mysql database.

What is Email?

 

E-mail is also known as electronic mail is the exchange of message from telecommunication. Where the messages are encoded in  ASCII text. However, non-text files, messages can also be sent, such as graphic images and sound files as attachments sent in binary format.emails are most popularly used today and it was also one of the first uses on the internet. Emails can also be sent to group of peoples as well as to individuals. Email is included with protocols in TCP/IP. A common protocol for sending mail is SMTP (Simple Mail Transfer Protocol).

 

Solution.

 

To send an e-mail message using SMTP authentication, There are two ways to do it one is by using third-party WordPress plugin or you can write your own code in a custom WordPress plugin.

 

1: USING A THIRD-PARTY PLUGIN

 

There are lots of WordPress plugins that can be used for e-mail functionality. One of the most common plugins is WP Mail SMTP, which allows you to configure email settings that are compatible with best website hosting servers.

 

Method 1: Installing the WP Mail SMTP plugin

 

1. login to Wordpress web hosting site as admin.

 

2. From left-hand side pane, click on plugins.

 

3. Then click on Add New.

 

4. In search plugins text box, type mail SMTP and press Enter.

 

5. From WPForms Locate WP Mail SMTP, and then click Install Now.

 

6. After installing the plugins click on Active.

 

Method 2. Configuring the WP Mail SMTP plugin.

 

1. login to Wordpress site as admin.

 

2. From left-hand side pane. click settings==>Email==>Advanced Email Options page appears.

 

3. In the From Email box. Use the email address from which you want to send the email. Note the email address should be created on your account.

 

4. In Mailer select the option Send all WordPress emails via SMTP.

 

5. In Return Path, select the Set the return-path to match the From Email check box.

 

6. under SMTP options, Enter full server name in SMTP host.

 

7. Then in configuration choose one of the following.

 

a, If you are using encryption, then use 465 in SMTP port and then under Encryption, select Use SSL encryption.

b, If you are not using encryption, then use 25 in SMTP port and then under Encryption, select No encryption.

 

8. In Authentication, select Yes: Use SMTP authentication.

 

9. In username, type your full email address which you have specified.

 

2: USING THE WORDPRESS API

 

If you don't want to use a third - party plugin to handle email for your Wordpress website hosting, You can develop your own custom code with WordPress API.

 

To send e-mail with SMTP authentication using the WordPress API. Follow the below steps.

 

1. In WP-config. PHP file of your WordPress site, copy and paste the following code:

 

define ('SMTP_HOST', 'server. hostingraja. in'); // enter your server hostname

define ('SMTP_AUTH', true);

define ('SMTP_PORT', '465');

define ('SMTP_SECURE', 'ssl');

define ('SMTP_USERNAME', This email address is being protected from spambots. You need JavaScript enabled to view it.');  // Username for SMTP authentication

define ('SMTP_PASSWORD', 'password');      // Password for SMTP authentication

define ('SMTP_FROM', This email address is being protected from spambots. You need JavaScript enabled to view it.');  // SMTP From address

define ('SMTP_FROMNAME', 'Hello world');     // SMTP From name

 

2. save the changes.

 

3. In your plugin file, copy and paste the below code:

 

add_action ('phpmailer_init', 'send_smtp_email');

function send_smtp_email ($phpmailer) {$phpmailer->is SMTP ();

$phpmailer->Host = SMTP_HOST;

$phpmailer->SMTPAuth = SMTP_AUTH;

$phpmailer->Port = SMTP_PORT;

$phpmailer->SMTPSecure = SMTP_SECURE;

$phpmailer->Username = SMTP_USERNAME;

$phpmailer->Password = SMTP_PASSWORD;

$phpmailer->From = SMTP_FROM;

$phpmailer->FromName = SMTP_FROMNAME;

}

 

4. To send an email message, call the wp_mail () function

 

Example:wp_mail("This email address is being protected from spambots. You need JavaScript enabled to view it.", "Subject", "Message");

 

The website then sends the message using the SMTP authentication settings you defined above.

 

If you are looking for the best WordPress hosting solution for your business then you are at right place. Here at HostingRaja we provide best in class WordPress hosting solution at an affordable price with amazing features, offers and discounts. We also provide managed hosting solution where our support team will take care of your website and hosting related issues and thus you can focus on your core business. Along with that we also provide 24/7 customer support via phone, chat, email and ticket system.

Today if you are looking for secured WordPress hosting solution then you can try our WordPress hosting with our server solution where you get highly secured servers with the latest security features. Also at an affordable price.