DKIM + Postfix + ISPConfig3 on Ubuntu 16.04 Gmail flags Emails as Spam

Discussion in 'Installation/Configuration' started by Loki, Feb 1, 2018.

  1. Loki

    Loki New Member

    Hi there,
    I followed this tutorial https://www.howtoforge.com/tutorial...l-pureftpd-bind-postfix-doveot-and-ispconfig/ and setup Postfix, with ISPConfig and roundcube, and everything works so far. But then I tried to send an email to my gmail address, and my Email got flagged as spam.
    After some research I found out, that I need to enable/use DKIM. So I found a few tutorials and found out, that ISPConfig can do all that for me. I just had to add the DKIM Info to my Domain Provider.
    But my Emails are still landing in the Spam Folder
    I get this from Gmail
    Code:
    Delivered-To: [email protected]
    Received: by 10.237.47.2 with SMTP id l2csp745418qtd;
            Thu, 1 Feb 2018 05:01:44 -0800 (PST)
    X-Google-Smtp-Source: AH8x224EwZnFyxiFzKjFBRl+Yoxqrju2Gv4VMqkZeR9xQyRw/lzY53wYFIhqqEsEb9QN0+SFGxsu
    X-Received: by 10.223.178.206 with SMTP id g72mr5403360wrd.213.1517490104508;
            Thu, 01 Feb 2018 05:01:44 -0800 (PST)
    ARC-Seal: i=1; a=rsa-sha256; t=1517490104; cv=none;
            d=google.com; s=arc-20160816;
            b=oTGdo2qTaf+NllZmw61d5vjkhjYEO+s4kU1N7aA03Lwi0WdH4+T4+Wb/Mhs4kYXZh9
             nFwL+Q7vn01F2mtkP56DpY1bA6ZrEKyTz7XT2NPVjejxGw+cjCNennRrzHnIDAKfp4sJ
             +vkIfOLUulVE+5ynSgNL6blaR24AGHG4T36QWtmrRK6PnkD+fK+HK8hn8b7sprSf8gv9
             h0sb2nhInxuEHFhykGs2DrqALD8HT0u/FVJMIAVXp2DcibeojbiT/eLfcieejL9B6Fdw
             cFahOdnpc9WQMtrYP6QvJXk6fOiQfN3uu5YuarjoUrt6nFTVMq60Gsoq9I9teYZ5jkCn
             tplw==
    ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
            h=user-agent:message-id:from:date:content-transfer-encoding
             :mime-version:subject:to:dkim-signature:arc-authentication-results;
            bh=HbIYyP9RxKEkrLJT9tSrDY02CfAsWzEkVJtZfdadr7Q=;
            b=OmrCmCaStdj8e9Tnp40wSo2ICpgj0y+t7kPRfJSTSZdw+vP+RFnfLi34AInFjHlQNV
             5c9Sbo4kiGcWiPUZ+b81dn/GdB4tziFcN/kEpJRJc50nVz/mJzNwnc9FxA1/C8TCf/6E
             +/oOr4C2NPKzUZG5d2abVubs6jT8aHoi3X44rZ1CPkwAWOBnAdw9A0y+qijhF/bx8tyQ
             zNcFdYqJrySPIQCi0R0wZgsh4Y++jFOgVFYnZvBEMMRriL2Yk5I/EMC60fH85Nd9DHLn
             JSIFdMMB+EEvqo5XH++D4skfXPY2Z22RYYw6jQZ4brlvnvOvUzuGw48i7V0EQX0abZJ4
             /EQQ==
    ARC-Authentication-Results: i=1; mx.google.com;
           dkim=pass [email protected] header.s=dkim header.b=E9qxhhOX;
           spf=pass (google.com: best guess record for domain of [email protected] designates 82.211.60.93 as permitted sender) [email protected]
    Return-Path: <[email protected]>
    Received: from mail.dieser-loki.de (mail.dieser-loki.de. [82.211.60.93])
            by mx.google.com with ESMTPS id x7si16444230wrd.236.2018.02.01.05.01.44
            for <[email protected]>
            (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
            Thu, 01 Feb 2018 05:01:44 -0800 (PST)
    Received-SPF: pass (google.com: best guess record for domain of [email protected] designates 82.211.60.93 as permitted sender) client-ip=82.211.60.93;
    Authentication-Results: mx.google.com;
           dkim=pass [email protected] header.s=dkim header.b=E9qxhhOX;
           spf=pass (google.com: best guess record for domain of [email protected] designates 82.211.60.93 as permitted sender) [email protected]
    Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.dieser-loki.de (Postfix) with ESMTP id F252D57A093D for <[email protected]>; Thu,
      1 Feb 2018 08:01:43 -0500 (EST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dieser-loki.de;
         h=user-agent:message-id:from:from:date:date :content-transfer-encoding:content-type:content-type :mime-version:subject:subject; s=dkim; t=1517490103; x= 1519304504; bh=HbIYyP9RxKEkrLJT9tSrDY02CfAsWzEkVJtZfdadr7Q=; b=E 9qxhhOXCk+irRDSkpl1LtKukFrcNdxt4whvF4Ce4q2n/rSuJrLgn2uBv4hf1aLQo en9iyw6uB9dOtGpAxnMdhjhfHlhxTVqdkOt+8s4t/i70x8CpMu9yguBe+OuBs8oZ nc0QGT5XNvTlKTb9zT07n90pDJ2Y3EJJo09C34vK94=
    X-Virus-Scanned: Debian amavisd-new at mail.dieser-loki.de
    Received: from mail.dieser-loki.de ([127.0.0.1]) by localhost (mail.dieser-loki.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GBMxhzaLkTE4 for <[email protected]>; Thu,
      1 Feb 2018 08:01:43 -0500 (EST)
    Received: by mail.dieser-loki.de (Postfix, from userid 33) id A467057A0C68; Thu,
      1 Feb 2018 08:01:43 -0500 (EST)
    To: myEmail <[email protected]>
    Subject: asddas
    X-PHP-Originating-Script: 0:rcube.php
    MIME-Version: 1.0
    Content-Type: text/plain; charset=US-ASCII; format=flowed
    Content-Transfer-Encoding: 7bit
    Date: Thu, 01 Feb 2018 14:01:43 +0100
    From: myEmail <[email protected]>
    Message-ID: <[email protected]>
    X-Sender: [email protected]
    User-Agent: Roundcube Webmail/1.2-beta
    
    asdads
    So my understanding is, that the DKIM stuff works. Digging returns
    Code:
    dig +short txt dkim._domainkey.dieser-loki.de
    "v=DKIM1; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyDQninnBozynJXLm3zhICZB/MCMAreOn9kgqn+sUhj0eVswW9ujZS63gAnz4uPukPKK1puFkX2WVF62Mzrprsy2ohhBvQKJeTpWp8LYrrIRjKOh/fTuqyxdE7fPEBOpGB26pC/fzaiQYxIm81BuMhhootip/8cDZyz754aSOx+QIDAQAB"
    The Dig seems to look okay too. What else is the Reason my emails are flagged as Spam
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    A valid dkim record is no guarantee that email is not flagged as spam. An email can be seen as spam when your IP has a bad reputation or when the content of the email is similar to spam mails etc.
     
  3. Loki

    Loki New Member

    Does that mean, that my config is correct? Is there a way to see why my Email is flagged as spam? Or is it because of this part in the Email
    Code:
    Received: from mail.dieser-loki.de ([82.211.60.93]) by mx-ha.web.de (mxweb010 [212.227.15.17]) with ESMTPS (Nemesis) id 1MMnT6-1eQq4h3rAS-00J1kd for <[email protected]>; Thu, 01 Feb 2018 16:44:07 +0100
    Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.dieser-loki.de (Postfix) with ESMTP id A64F357A00EB; Thu, 1 Feb 2018 10:44:07 -0500 (EST)
    I'm not sure why there is Received: from localhost
    I dont think the content of the email body is the reason for this. Since it was regular conversation.
     
  4. CorSch

    CorSch New Member

    I have the same spam issues with gmail.com. My Emails are shown as correctly authenticated (DKIM, SPF & DMARC are fine)

    Additionally I tried to add my Host/IP to https://postmaster.google.com/managedomains and dnswl.org to get a better reputation.
     
  5. Loki

    Loki New Member

    I registered myself with that google site but didnt help.
    I'm pretty sure now, that the Problem is this part
    Code:
    Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.dieser-loki.de (Postfix) with ESMTP id F252D57A093D for <[email protected]>; Thu,
      1 Feb 2018 08:01:43 -0500 (EST)
    Though I am not sure why this happens. I tried to add an SPF entry for my domain, but this doesnt help either.
    My Entry is
    Code:
    v=spf1 mx -all
    hostname -f returns mail.dieser-loki.de
    My postfix main.cf has
    Code:
    myhostname = mail.dieser-loki.de
    mydestination = mail.dieser-loki.de
    there is no mention of localhost anywhere.
    The domains are read from the DB (as done with ISPConfig) where there is only 1 entry, for my domain
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    That's the internal spam scan process and not related to your gmail problem. This line exists in mails from all systems that use a spam scanner like amavis and this does not trigger spam tagging at gmail or other mail services. I have this line in my mails as well and my mails are not listed as spam at gmail or hotmail. The Received header that matters is the first one and that does not contain localhost.

    Received: by mail.dieser-loki.de (Postfix, from userid 33) id A467057A0C68; Thu, 1 Feb 2018 08:01:43 -0500 (EST)

    But what might matter is that you are sending with php "X-PHP-Originating-Script: 0:rcube.php" and not a desktop client. You can try to alter your roundcube config so that roundcube sends trough the server hostname (not localhost) and that roundcube uses smtp authentication when connecting to the mail server, this might add some additional trust at gmail.
     
    Last edited: Feb 1, 2018
  7. Loki

    Loki New Member

    I am using Apple Mail now, and my emails are still flagged as spam. The "X-PHP-Originating-Script: 0:rcube.php" is obviously not inside the email.
    But my Email is getting marked as spam. I tried it too with yahoo, msn and web.de all of them mark my emails as spam.
    I changed some config in Roundcube, to use smtp auth just as you recommended, but that shouldnt affect any emails I'm sending with Apple Mail.
    Here is another Email, sent by applemail. (And its signed, so there is this additional bit)
    Code:
    Delivered-To: [email protected]
    Received: by 10.100.140.135 with SMTP id v7csp3122754pja;
            Mon, 5 Feb 2018 13:15:43 -0800 (PST)
    X-Google-Smtp-Source: AH8x224Lyj5zxAw8qZZ18m6DPKoF/iRMWSZL3TrUR/WXn4T+ax8WovYcvo/AmQpHxceVdf0myn4B
    X-Received: by 10.223.209.80 with SMTP id b16mr147448wri.86.1517865343748;
            Mon, 05 Feb 2018 13:15:43 -0800 (PST)
    ARC-Seal: i=1; a=rsa-sha256; t=1517865343; cv=none;
            d=google.com; s=arc-20160816;
            b=ynJZpHzB4J7x9g2zBqwqepbi8dmILV82u7UkRfKYH9fxfLZMu5D4ofn8o0InrKKLKW
             u9QrR0X6Oj77eeKuIHEn3LVY13TmQZSRGR8VNf41GO8uMnCq4NuJj/5aKJSmmY7dNY/a
             c3bM9KiDK6TK35vTGB87z3zZ3ioru2LuUOquO4M6fWLif3TLJ12e7HgsuJosGphAMiIt
             EtKLkjT1NKjyKapQmGfgfcacebcp7meWK97TsmAP1tsaaz/Vp9Gxk8Pd+38LnyN8Dvnt
             2rsWZWZYvLoZroewApZaIUF7rIfbxrQlFNYicImd6ycOrAPMaEQ9mDl+pznALmmN13HQ
             x+sQ==
    ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
            h=to:date:message-id:subject:mime-version:from:dkim-signature
             :arc-authentication-results;
            bh=B/P2kx0LaQBsqesXQ1Plqvf+ihtfIdn4J8J2ZTdG+fw=;
            b=UNxURY0hU7qu5QFMI4QZmzw8lUJSlPokc9azcli3vbH0PchU0qb+r3JEICufyFBMUR
             YWztVGE9w6m/KA48xOWo6IWxu5CWxCAvX+Ea6W9guEGNgvEIK25vGwl9V2ws3CZhWrgG
             if53BPKK5QGIUbX8frgJ85onxynF72fF5/1At72a/Yt2ig+tEFDAg0D6QTeRsKaa8g70
             d1+lVUrk5o0NCxGl2q+fOqdYHSyFVg2OFYXYmSjRYYYT7LsYshvLF7gxtvv0DfsdPV76
             hJdvTO2SIhINfXk5tL+y1JxX/iMCiWVwd1lu1ecAwn0msK7rbJSXVy8C87B30koN2/8z
             LgaQ==
    ARC-Authentication-Results: i=1; mx.google.com;
           dkim=pass [email protected] header.s=dkim header.b=q21wKnOa;
           spf=pass (google.com: domain of [email protected] designates 82.211.60.93 as permitted sender) [email protected]
    Return-Path: <[email protected]>
    Received: from mail.dieser-loki.de (mail.dieser-loki.de. [82.211.60.93])
            by mx.google.com with ESMTPS id g131si6086655wma.139.2018.02.05.13.15.43
            for <[email protected]>
            (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
            Mon, 05 Feb 2018 13:15:43 -0800 (PST)
    Received-SPF: pass (google.com: domain of [email protected] designates 82.211.60.93 as permitted sender) client-ip=82.211.60.93;
    Authentication-Results: mx.google.com;
           dkim=pass [email protected] header.s=dkim header.b=q21wKnOa;
           spf=pass (google.com: domain of [email protected] designates 82.211.60.93 as permitted sender) [email protected]
    Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.dieser-loki.de (Postfix) with ESMTP id EDCBF57A0F6F for <[email protected]>; Mon,
      5 Feb 2018 16:15:12 -0500 (EST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dieser-loki.de;
         h=x-mailer:date:date:message-id:subject:subject:mime-version :content-type:content-type:from:from; s=dkim; t=1517865312; x= 1519679713; bh=DPHsgydIWzPiPdjZfduLe8VOtxFonfvry1+62FJIx+I=; b=q 21wKnOafqZ9/DqE5BcYgu7JdJI1ZbGN1K5FjrP4sOd3dfCIweB/d/jNEoq+3n9j8 KWcruux+K2GFjtnxhDNgqKUxbkJi3OlwoSrbigsorB0fuHzE1s03KRVVOca2WxiN aqBiy/r4Z5BZpUjA1E8y3HO8FyfMtVC7mo140QOaQI=
    X-Virus-Scanned: Debian amavisd-new at mail.dieser-loki.de
    Received: from mail.dieser-loki.de ([127.0.0.1]) by localhost (mail.dieser-loki.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id BJvt7jGtfWNx for <[email protected]>; Mon,
      5 Feb 2018 16:15:12 -0500 (EST)
    Received: from slpn-nb-mje-6.fritz.box (46-59-254-7.lsn6.wtnet.de [46.59.254.7]) (Authenticated sender: [email protected]) by mail.dieser-loki.de (Postfix) with ESMTPSA id 6E14857A0916 for <[email protected]>; Mon,
      5 Feb 2018 16:15:12 -0500 (EST)
    From: TestGuy <[email protected]>
    Content-Type: multipart/signed; boundary="Apple-Mail=_8B87C165-FE1F-4CD0-A3F5-2F300E495C57"; protocol="application/pgp-signature"; micalg=pgp-sha512
    Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\))
    Subject: Test
    Message-Id: <[email protected]>
    Date: Mon, 5 Feb 2018 22:15:11 +0100
    To: [email protected]
    X-Mailer: Apple Mail (2.3445.5.20)
    
    --Apple-Mail=_8B87C165-FE1F-4CD0-A3F5-2F300E495C57
    Content-Transfer-Encoding: 7bit
    Content-Type: text/plain; charset=us-ascii
    
    Diese Email wurde mit Apple Mail verschickt!
    
    Ich hoffe das funktioniert
    
    --Apple-Mail=_8B87C165-FE1F-4CD0-A3F5-2F300E495C57
    Content-Transfer-Encoding: 7bit
    Content-Disposition: attachment; filename=signature.asc
    Content-Type: application/pgp-signature; name=signature.asc
    Content-Description: Message signed with OpenPGP
    
    -----BEGIN PGP SIGNATURE-----
    
    iQIzBAEBCgAdFiEENGDg361TIJY92EtCeXWu06jHYXgFAlp4yV8ACgkQeXWu06jH
    YXjpLg/+KQf/cXdMgyWBGg5n3tGWJ9ShulT9J8mInPaz5UHxPOVJvCQi3d2C4bEa
    lC8NkYTsga63j0wH+YWsrU4xDqOdz9+mjttk4SZIWnybsTjPFhw1trPoceUlWiQv
    3DbpgIv2tOtWf+iv3C/y+k3OCP8w0so6wPcrNJLjusx3M1EQqAns+y65tde4nKSr
    bJ8vzwU/22WO1rqcC2YhBIvXGq0qiegixbMnH7Hj1nHESA5kWSvrSz3afEV7KIl/
    Y6R7YTE+V7eEei4kxU0QeGX0Ef8oUlzD4W5zLclbBpolfu3YjhjEWiVtVVVjJhiI
    OdsgRN4hbIiVOK2Is13zanpEn837hHqLptotPb5Ndh0nWZP1jg4DwFa59nGUzVvI
    T7G/+WkGc8gDEaqBGVaWViZEEenDqBhITC//rV+2avwqlIeR5PeoSF10g13JV6ah
    ixzSsuQ5mnC+7qexG/jwdvNUjU6s5OV2cIbXOQmKpAtWwScAPd7B/cAz2z215ti6
    60le+HpfPBAJDtm68/4C0KaM+o07bguA3gftyYnzkb9HcyWMty4SaPj8SEq38u0Z
    Z+MvVWmLUjW+RoYMJEqnL5wuJd0I3H2k9mQQS5tWDgAPTjufRqUUlFnluPi98cQS
    Z4bGcnuEQZ7gKIbezUrqoSAdmdkgPEN/oGLE3pCGPgyYI0BVNFw=
    =YoHc
    -----END PGP SIGNATURE-----
    
    --Apple-Mail=_8B87C165-FE1F-4CD0-A3F5-2F300E495C57--
     

Share This Page