Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Tuesday, August 3rd at 3pm PST / 6pm EST. Learn more
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GoDaddy no cooperating with PHPMailer

I have economy linux hosting with cpanel.  I have email accounts hosted by gmail, but using my domain name:  Our site uses a contact form that runs off PHPMailer.  Messages are supposed to be sent to   Using the form reports a successful send, but no messages ever make it to the destination.  GoDaddy support sent me to this page which was unhelpful (settings were already correct):  Then they said the problem must be with the code.  The company I bought the code from says that the problem lies with GoDaddy not processing the form correctly, but they won't give me any details on what needs to be done to fix it. 

Contents of  rd-mailform.config.js:

"useSmtp": false,
"host": "localhost",
"port": 25,
"username": "",
"password": "",
"recipientEmail": ""


When I change smtp to "true," I get an error and browser console XHR entry reports the following: "SERVER -> CLIENT: ESMTP Exim 4.93 #2 Sun, 04 Apr 2021 15:05:07 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. "


Contents of rd-mIailform.php:



$formConfigFile = file_get_contents("rd-mailform.config.json");
$formConfig = json_decode($formConfigFile, true);


try {
require './phpmailer/PHPMailerAutoload.php';

$recipients = $formConfig['recipientEmail'];

preg_match_all("/([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)/", $recipients, $addresses, PREG_OFFSET_CAPTURE);

if (!count($addresses[0])) {

function getRemoteIPAddress() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {

} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {

if (preg_match('/^(127\.|192\.168\.|::1)/', getRemoteIPAddress())) {

$template = file_get_contents('rd-mailform.tpl');

if (isset($_POST['form-type'])) {
switch ($_POST['form-type']){
case 'contact':
$subject = 'A message from your site visitor';
case 'subscribe':
$subject = 'Subscribe request';
case 'order':
$subject = 'Order request';
$subject = 'A message from your site visitor';

if (isset($_POST['email'])) {
$template = str_replace(
array("<!-- #{FromState} -->", "<!-- #{FromEmail} -->"),
array("Email:", $_POST['email']),

if (isset($_POST['message'])) {
$template = str_replace(
array("<!-- #{MessageState} -->", "<!-- #{MessageDescription} -->"),
array("Message:", $_POST['message']),

// In a regular expression, the character \v is used as "anything", since this character is rare
preg_match("/(<!-- #\{BeginInfo\} -->)([^\v]*?)(<!-- #\{EndInfo\} -->)/", $template, $matches, PREG_OFFSET_CAPTURE);
foreach ($_POST as $key => $value) {
if ($key != "counter" && $key != "email" && $key != "message" && $key != "form-type" && $key != "g-recaptcha-response" && !empty($value)){
$info = str_replace(
array("<!-- #{BeginInfo} -->", "<!-- #{InfoState} -->", "<!-- #{InfoDescription} -->"),
array("", ucfirst($key) . ':', $value),

$template = str_replace("<!-- #{EndInfo} -->", $info, $template);

$template = str_replace(
array("<!-- #{Subject} -->", "<!-- #{SiteName} -->"),
array($subject, $_SERVER['SERVER_NAME']),

$mail = new PHPMailer();

if ($formConfig['useSmtp']) {
//Tell PHPMailer to use SMTP

//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 3;

$mail->Debugoutput = 'html';

// Set the hostname of the mail server
$mail->Host = $formConfig['host'];

// Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;

// Whether to use SMTP authentication
$mail->SMTPAuth = false;
$mail->SMTPSecure = "";
$mail->SMTPAutoTLS = false;

// Username to use for SMTP authentication
$mail->Username = $formConfig['username'];

// Password to use for SMTP authentication
$mail->Password = $formConfig['password'];

$mail->From = $_POST['email'];

# Attach file
if (isset($_FILES['file']) &&
$_FILES['file']['error'] == UPLOAD_ERR_OK) {

if (isset($_POST['name'])){
$mail->FromName = $_POST['name'];
$mail->FromName = "Site Visitor";

foreach ($addresses[0] as $key => $value) {

$mail->CharSet = 'utf-8';
$mail->Subject = $subject;

} catch (phpmailerException $e) {
} catch (Exception $e) {



I've spent days with GoDaddy and the code provider, and have asked on other forums with no luck.  Maybe somebody here has an idea on what I can do to fix it?


No answer. Similar issue. My php code for mail() worked fine. Coincidentally, with Godaddy's change-over to MS 365, my code no longer sends emails to clients. Tech's at Godaddy insist the issue is with my code which they are not allowed to comment on or discuss. I fail to see the logic there since my code has not changed. Very difficult time finding anything to resolve this online.

Getting Started

Have you tried running an old version of php?  My contact form stopped running when there was a system change (that I did not notice) and I've spent ages trying to work out why the new version doesn't work.  Have gone back to phpv5.4.45 for now just to have it going again.

Postscript: I was thinking about this more and decided to check the phpinfo() page between the different versions (a side by side for 5.4.45 and 7.3.29).  The act of forcing plesk to re-create the files for 7.3.29 meant that my contact form now works again.  Go figure.  Nothing actually changed other than changing versions manually.