Postfix Localhost Server Sending Spam to Itself

Nick Thompson asked:

I have an iRedMail server that runs Postfix and am trying to determine the source of its spam problem.

I have since changed the MX records on the domain for the address receiving spam and the good news is no spam is coming through to this second server. However, new spam messages keep appearing at the old server, despite the MX record change. How is that possible?

Here is a header from one of the spam emails:

Content-Type: multipart/alternative; boundary="6656864_13052705_6656864"
Mime-Version: 1.0
Return-Path: <>
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: Debian amavisd-new at
Received: from localhost (localhost []) by (Postfix) with ESMTP id 293FD6B977 for <>; Tue, 12 Jan 2016 20:45:14 -0700 (MST)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id G3TC68wvWWEK for <>; Tue, 12 Jan 2016 20:45:13 -0700 (MST)
Received: from (unknown []) by (Postfix) with ESMTP id 480626B976 for <>; Tue, 12 Jan 2016 20:45:12 -0700 (MST)
Message-Id: <>
Re: Macy's is giving out a $50 voucher to start 2016

Does this appear to be coming from my own server? Or is it coming from this IP?: That IP is blacklisted on Spamhaus, which I have postfix set to query.

Here part of my /var/logs/mail.log file

Jan 13 03:45:11 mailhost postfix/smtpd[4796]: connect from unknown[]
Jan 13 03:45:12 mailhost postfix/smtpd[4796]: 480626B976: client=unknown[]
Jan 13 03:45:12 mailhost postfix/cleanup[4806]: 480626B976: message-id=<>
Jan 13 03:45:13 mailhost postfix/qmgr[9274]: 480626B976: from=<>, size=5484, nrcpt=1 (queue active)
Jan 13 03:45:13 mailhost postfix/smtpd[4796]: disconnect from unknown[]
Jan 13 03:45:14 mailhost postfix/smtpd[4815]: connect from localhost[]
Jan 13 03:45:14 mailhost postfix/smtpd[4815]: 293FD6B977: client=localhost[]
Jan 13 03:45:14 mailhost postfix/cleanup[4806]: 293FD6B977: message-id=<>
Jan 13 03:45:14 mailhost postfix/qmgr[9274]: 293FD6B977: from=<>, size=5943, nrcpt=1 (queue active)
Jan 13 03:45:14 mailhost postfix/smtpd[4815]: disconnect from localhost[]
Jan 13 03:45:14 mailhost amavis[31884]: (31884-08) Passed CLEAN, LOCAL [] [] <> -> <>, Message-ID: <>, mail_id: G3TC68wvWWEK, Hits: -0.546, size: 5482, queued_as: 293FD6B977, 568 ms
Jan 13 03:45:14 mailhost postfix/smtp[4812]: 480626B976: to=<>, relay=[]:10024, delay=2, delays=1.4/0.01/0.01/0.58, dsn=2.0.0, status=sent (250 2.0.0 from MTA([]:10025): 250 2.0.0 Ok: queued as 293FD6B977)
Jan 13 03:45:14 mailhost postfix/qmgr[9274]: 480626B976: removed
Jan 13 03:45:14 mailhost postfix/pipe[4816]: 293FD6B977: to=<>, relay=dovecot, delay=0.09, delays=0.01/0.01/0/0.07, dsn=2.0.0, status=sent (delivered via dovecot service)

I also thought there might be a PHP script somewhere sending this mail, so I installed and ran Linux Malware Detect, but it found nothing.

Thanks for your help!

EDIT: I have blacklist filtering on in

smtpd_recipient_restrictions = 
        check_policy_service inet:, 
        check_policy_service inet:, 

My answer:

This email came from outside your server, from the indicated IP address.

Postfix is configured to pass it to Amavis for virus scanning, and when that is complete, Amavis passes it back to Postfix for delivery.

This is why there are two localhost Received: lines. One is added by Amavis when it processes the message, and the other one when Postfix re-accepts it from Amavis for final delivery.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.