• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved My mail server is on a spam list

brownbag

Basic Pleskian
My outgoing mail is being blocked by certain mail servers with the following error:
<[email protected]>: host mail.abuseat.org[54.93.50.35] said: 550 *** The
HELO for IP address 139.180.168.140 was 'localhost.localdomain' (invalid
syntax) *** (in reply to RCPT TO command)

It appears that to resolve this, I have to "correct your HELO localhost.localdomain and if needed, configure your mail server with correct DNS (forward and reverse) and HELO/EHLO values".
My mail server is on my plesk server and I'm using phpmailer to send mail.

The code that I use to send mail (edited for privacy and simplicy reasons) is:

PHP:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

        $mail = new PHPMailer(true);

        //Server settings
        $mail->SMTPDebug = 0;
        $mail->isSMTP();
        $mail->Host       = 'mydomain.com';
        $mail->SMTPAuth   = true;
        $mail->Username   = '[email protected]';
        $mail->Password   = '***************';
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
        $mail->Port       = 587;

        //Recipients
        $mail->setFrom([email protected], 'My company');
        $mail->addAddress([email protected]);
        $mail->addCC($cc_email);
        $mail->addReplyTo([email protected], 'do not reply');

        // Content
        $mail->isHTML(true);
        $mail->Subject = 'subject';
        $mail->Body    = 'message';
        $mail->AltBody = 'message';

        $mail->send();

Can I get some advice on areas that I should look for to 'fix' this problem.
 
I have found a solution that seems to be suited. My hostname wasn't set so that's probably the issue.
I've modified the hostname by modifying /etc/hosts, but what is odd is that it is not reflected immediately.

My hosts file is as follows:

127.0.0.1 localhost.localdomain localhost

# The following lines are desirable for IPv6 capable hosts
::1 localhost.localdomain localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
hostname servername.mydomain.com

changes to hostname are meant to take effect immediately but the hostname command still returns
localhost.localdomain.

do I need to remove the first line which seems to set it to localhost.localdomain? Why is this line there?
 
Back
Top