Toll Free: 0800-1-JOLIS

Knowledgebase

It all starts with a domain name ♣ Find your perfect domain name
PHP Mail Function Disabled on Shared Web Hosting

PHP Mail Function Disabled on Shared Web Hosting

We decided to disable the mail function because the mail() function was often used by malicious users on our network to send spam and other unsolicited e-mails.

We recommend our customers to use an e-mail library in order to send e-mails, and there are many in which to choose from.

PHPMailer

The PHPMailer library has a built-in Mail class for sending e-mails, including e-mails over SMTP authentication with an already-existing e-mail account. Here's an example of a basic SMTP configuration:

$mail->isSMTP();
$mail->Host       = 'mail.yourdomain.com';
$mail->SMTPAuth   = true;
$mail->Username   = 'email@yourdomain.com';
$mail->Password   = 'Some-Password';
$mail->Port       = 25;

PEAR Library

The PEAR library also has a built-in Mail class for sending e-mails, including e-mails over SMTP authentication with an already-existing e-mail account. Here's an example:

include('Mail.php');
$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
$smtp = Mail::factory('smtp', array ('host' => 'mail.yourdomain.com', 'auth' => true, 'username' => 'email@yourdomain.com', 'password' => 'Some-Password', 'port' => '25'));
$mail = $smtp->send($to, $headers, $body);

How to Configure WordPress To Send Emails Using SMTP

By default, WordPress uses the PHP Mail function to send its emails. However it is recommended to use SMTP as it handles sending messages better and you can also use it to send emails from a third party mailing service.

To begin, first you need to install a plugin named WP Mail SMTP . Once the plugin is installed and activated, a new menu will show up under the Settings section called Email. You will need to navigate to it in order to configure WordPress to work with SMTP.

Select 'Other SMTP' and Scroll down to the 'Other SMTP' section. Make sure to toggle the 'Authentication' button.

SMTP Host 	- 	mail.yourdomain.com
Encryption  - 	None
SMTP Port 	- 	25
Auto TLS	-	OFF
Username 	- 	email@yourdomain.com
Password 	- 	Some-Password

Click the Save Settings button.