title: Postfix / Spamassassin: Undelivered Mail Returned to Sender
body: <p>I'm having an issue with a newly configured mailserver where spam emails that are spoofed to come from the local domain are actually accepted by the mailserver, the mail isnt delivered as is though, the spamassassin tags it as spam and then send an email "Undelivered Mail Returned to Sender" to the spoofed local user.</p>
  
  <p>I know there is a way of fixing this in the configuration but i have no idea where, i'm hoping someone can point me in the right direction.</p>
  
  <p>To be clear, the mailserver is not relaying, this is only a local user issue.
  I want postfix to reject any emails supposedly from local users that aren't sent internally. It would stop this problem.</p>
  
  <p>Here is an email to show you whats happening. I've changed the domain to example.com.au.</p>
  
  <blockquote>
    ###############################################<br>
    
    <p><br>
    This is the mail system at host example.com.au. <br>
    <br>
    I'm sorry to have to inform you that your message could not <br>
    be delivered to one or more recipients. It's attached below.<br>
    <br>
    For further assistance, please send mail to postmaster.<br>
    <br>
    If you do so, please include this problem report. You can <br>
    delete your own text from the attached returned message.<br>
    <br>
    The mail system<br>
    <br>
    : host 127.0.0.1[127.0.0.1] said: 554 5.7.0 Reject, id=11887-07 - SPAM (in reply to end of DATA command) <br> ? <br>
    Reporting-MTA:dns; example.com.au<br>
    X-Postfix-Queue-ID: 661DC5D1DE<br>
    X-Postfix-Sender: rfc822; dan@example.com.au<br>
    Arrival-Date: Tue, 5 May 2009 06:21:38 +1000 (EST)<br>
    <br>
    Final-Recipient: rfc822;dan@example.com.au <br>
    Original-Recipient:rfc822;dan@example.com.au<br>
    Action: failed Status: 5.7.0 <br>
    Remote-MTA: dns; 127.0.0.1 <br>
    Diagnostic-Code: smtp; 554 5.7.0 Reject, id=11887-07 - SPAM ?<br>
    <br>
    <strong>From: Berenice Penez </strong><br>
    Date: Mon, 4<br>
    May 2009 22:21:41 +0200<br>
    <strong>To: </strong> Subject: Were it you, on forum?<br>
    <br>
    Reliable quality and no delays with<br>
    delivery! Super online store for<br>
    disease treating<br>
    <a href="http://www.xopfekec.cn/" rel="nofollow noreferrer">http://www.xopfekec.cn/</a><br>
    <br></p>
    
    ###############################################<br>
  </blockquote>
  
  <p>Postfix main.cf (the important parts, not complete)</p>
  
  <blockquote>
    <p>readme_directory = /usr/share/doc/postfix<br>
    mydomain_fallback = localhost<br>
    message_size_limit = 0<br>
    mailbox_size_limit = 0<br>
    myhostname = example.com.au<br>
    mailbox_transport = cyrus<br>
    mydomain = example.com.au<br>
    inet_interfaces = all<br>
    enable_server_options = yes<br>
    mydestination = $myhostname,localhost.$mydomain,localhost,example.com.au<br>
    smtpd_sasl_auth_enable = yes<br>
    smtpd_use_pw_server = yes<br>
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination,reject_unknown_recipient_domain,reject_unknown_sender_domain,reject_invalid_hostname<br>
    smtpd_pw_server_security_options = plain,login<br>
    content_filter = smtp-amavis:[127.0.0.1]:10024<br>
    mynetworks = 127.0.0.0/8, 10.0.1.0/24<br>
    smtpd_client_restrictions = permit_sasl_authenticated,reject_rbl_client dnsbl.sorbs.net<br></p>
  </blockquote>