SMTP Authentication Failure
The Mail::factory PHP Script does not like to play well with some of our servers,
Instruct the client instead to use this one - https://github.com/PHPMailer/PHPMailer
When sending emails in cPanel, mailer script must utilize smtp authentication and PHP-Pear module or mails will not go out. To verify if Pear module is installed, login to cpanel > PHP PEAR Packages > show system installed modules.
Then, mailer script can be tailored/modified as per below:
<?php
require_once "Mail.php";
$from = "MyName <name@myemail.com>";
$to = "TargetName <name@targetemail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.mailserver.com";
$username = "name@myemail.com";
$password = "my_password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
Related Articles
How Do I Enable SMTP Authentication? Mail-Clients
You can manually configure your POP3 e-mail software package. Instructions to update your setting manually: Email software you can set up to access your e-mail on your PC Microsoft Outlook®; Express (PC) Windows® Mail (PC) Microsoft Outlook® 2010 ...
Setting up SMTP Authentication in Apple (Mac) Mail for Existing Mailbox
SMTP Authentication Setup for Apple Mail 1. Open Mail and go to Mail --> Preferences 2. Select the "Accounts" tab and select the Account you wish to configure. 3. Make sure the "Account Information" tab is selected. At the bottom of this screen there ...
Setting up SMTP Authentication in Apple (Mac) Mail for Existing Mailbox
SMTP Authentication Setup for Apple Mail 1. Open Mail and go to Mail --> Preferences 2. Select the "Accounts" tab and select the Account you wish to configure. 3. Make sure the "Account Information" tab is selected. At the bottom of this screen there ...
How to install & configure SMTP Plugin in WP (WordPress)
This guide is meant for customers on any shared/reseller hosting servers. we also recommend that customers with their own servers have the same security protocol in place, do not send out email without smtp authentication, and only configure against ...
Step by Step for Setting up Mail Clients w/ SMTP AUTH
Launch Outlook Select "Tools" from the Menu bar. Select "Email Accounts" from the Tools menu. The Email Accounts Wizard will appear. Under the Email heading, select "Add a new email account." Click "Next." Select server type. In ...