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.
$mail->isSMTP(); $mail->Host = 'mail.yourdomain.com'; $mail->SMTPAuth = true; $mail->Username = 'firstname.lastname@example.org'; $mail->Password = 'Some-Password'; $mail->Port = 25;
include('Mail.php'); $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => 'mail.yourdomain.com', 'auth' => true, 'username' => 'email@example.com', 'password' => 'Some-Password', 'port' => '25')); $mail = $smtp->send($to, $headers, $body);
How to Configure WordPress To Send Emails Using SMTPBy 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 - firstname.lastname@example.org Password - Some-PasswordClick the Save Settings button.