0
votes

I am using phpmailer 5.2.2 and godaddy Linux host with cPanel.

After many tries on difference solution. It seems that all of methods is not suitable for me. To make it easier, I focus on methods provided by godaddy's staff.

  1. Localhost method(as following code) >>> How can I get this authorization to send the email?

Although the result is "Email sent.", the recipient email do not receive any mail or junk mail. For SMTP debug, godaddy's server gives me a message: 220-We do not authorize the use of this system to transport unsolicited,220 and/or bulk e-mail.

<?php

require_once 'bat/phpmailer/PHPMailerAutoload.php';

$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host       = "localhost";
$mail->Port       = 25;
$mail->SMTPSecure = false;                 
$mail->SMTPAuth   = false;
$mail->Username   = "";
$mail->Password   = "";

$mail->SMTPDebug  = 3;
$mail->Debugoutput= 'error_log';

$mail->IsHTML(true);
$mail->AddAddress("[email protected]");

$mail->CharSet = "utf-8";
$mail->setFrom('[email protected]', 'test name');
$mail->Subject = 'test title';
$mail->Body = 'testing content';

if (!$mail->Send()) {
    echo "Error: " . $mail->ErrorInfo;
} else {
    echo "<b>Email sent.</b>";
}

?>
  1. set host as 'relay-hosting.secureserver.net' >>> why it can't connect to server?

Another godaddy's staff suggest this host but it is worse. Using 'relay-hosting.secureserver.net', the debug message even shows: SMTP ERROR: Failed to connect to server: Connection refused (111). For this problem, I tried to live chat with their staff. Until now, their advises didn't helps.

Any one is successful in using their suggestion code? Please gives me some clues!

Many thanks...

1
Are you sending the email from an email address that actually exists within your hosting package?RiggsFolly
you need to add the smtp username(email) and password, remove $mail->SMTPDebug = 3; it is written twice, also made $mail->SMTPAuth = false; to true. you need to add the host for godaddy at $mail->Host = "localhost";Prashant Barve
@RiggsFolly I am using the cpanel email as sender.asservir
Don't use PHPMailer 5.2.2 - it's very old and has many bugs and vulnerabilities that have been fixed since its release in 2012. Sending email from shared hosting is a losing battle.Synchro
@PrashantBarve thx 4 ur advises. I tried the first and second instructions. Server still shows the 220 message to me. Also, what do you mean by 'add the host for godaddy at $mail->Host = "localhost";'.asservir

1 Answers

2
votes

19/6/2018 update:

For godaddy Cpanel user, the following setting may work. You should disable SMTPAutoTLS to make it work.

$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->SMTPSecure = false;
$mail->SMTPAutoTLS = false;
$mail->SMTPAuth = false;