https://panelsecure.com/kb/54/

Unable to send email from server using PHP mail() function


After the recent update of cPanel v64, all outgoing emails sent through PHP scripts will need to be authenticated and routed through an email address created through cPanel. This is done to prevent Malware injected spam emails sent through the server and to prevent the server IP from being blacklisted. Please follow the instructions for Wordpress or Joomla, or please contact your website developer and request them to update the PHP code with SMTP authentication, you can find PHP sample code(link below)


Example for Wordpress or Joomla:
Wordpress : http://tinyurl.com/mllh8gm
Joomla : http://tinyurl.com/yb4496ol

PHP Sample Code:
https://tinyurl.com/y8s73ova   (or)  https://github.com/PHPMailer/PHPMailer.git


PanelSecure has created 2 versions of PHPMailer examples, that's ready for use and fully tested.

Download Version 1 (or) Download Version 2

Instructions To Use:
1. Unzip the files and upload the entire folder contents, including PHPMailer libraries.
2. Before you configure the script, make sure to create the mail account in cPanel.
3. Just edit 5 lines (shown below) in "email.php" and open the index.html to test on the server.

$mail->Host = "mail.domain.com";
$mail->Username = "feedback@domain.com";
$mail->Password = "1234567890";
$mail->AddAddress("my@gmail.com", "AnyName");
$mail->Subject = "Feedback from your website!";

// Enter "mail.my-domain.com"
// Enter an email address created through cPanel
// Enter the email password created through cPanel
// Enter the recipient "to" email address
// For subject "Any Preferred Email Subject"

 


For some servers, inside "email.php" modify settings to:
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
 
Important Note: The example code above, has been provided to help clients to quickly fix an online inquiry or feedback form. At any time if you have trouble in configuring this test script inside your hosting account, please reach out to our support department to install this sample PHPMailer script. Do not contact us requesting to fix your existing website's mail code, we'll only configure and show that the above sample test code is working on the server and will not troubleshoot any of your mailing scripts. For any assistance beyond this, you will need to hire a PHP programmer. PanelSecure's Support Team will not help you in coding related matters!


 .


  • 681 Users Found This Useful
Was this answer helpful?

Related Articles

Unable to access the login page of WHM or cPanel or WebMail

If you cannot see the login page of WHM / cPanel / WebMail, then probably your LOCAL Internet...

Disable Apache mod_cache for Dynamic Web Contents

Most web sites have large amounts of content that remains unchanged or is rarely modified after...

Fixing WordPress Permalink / URL Errors

The "Permalinks" functionality of WordPress enables Apache's "mod_rewrite" function to generate...

Powered by WHMCompleteSolution