Problem with 'CC' & 'BCC' email not being delivered.

Discussion in 'HOWTO-Related Questions' started by snowfly, Jul 7, 2006.

  1. snowfly

    snowfly Member

    Hi,

    I've got a problem with my mail server in that any 'CC' or 'BCC' email is not being delivered.

    The sever is running virtual mail setup with:
    - Debian Sarge
    - 2.4.27 smp kernel
    - courier 0.47-4 courier-pop, courier-imap, courier-authmysql
    - postfix 2.1.5-0 postfix-mysql, postfix-tls
    - maildrop 1.6.3, maildropmysql
    - spamassassin
    - clamav 0.88.2
    - amavisd

    Basically, if someone sends an email (from anywhere) to an email address on my server, and also CC or BCC an email address on my server, it gets delivered to the person in "To:", but not to "CC" and "BCC.

    Eg: Consider the following 3 people
    - PersonA with an external address: persona@gmail.com
    - PersonB with address on my server: a@myserver.co.nz
    - PersonC with address on my server: b@myserver.co.nz

    Suppose PersonA sends the following email:
    To: a@myserver.co.nz
    CC: b@myserver.co.nz
    Subject: foobar
    Message: test

    a@myserver.co.nz receives the email successfully in their inbox.
    However b@myserver.co.nz doesn't, nothing arrives, seems the CC email disapears.

    I get the following extract in my mail log:
    Code:
    Jul  7 14:12:10 aqua postfix/qmgr[31036]: 44C6554EAA: from=<persona@gmail.com>, size=3280, nrcpt=2 (queue active)
    Jul  7 14:12:10 aqua amavis[8578]: (08578-04) ESMTP::10024 /var/amavis/tmp/amavis-20060707T140450-08578: <persona@gmail.com> -> <a@myserver.co.nz>,<b@myserver.co.nz> Received: SIZE=3280 from aqua.xxx.co.nz ([127.0.0.1]) by localhost (aqua [127.0.0.1]) (amavisd-n
    ew, port 10024) with ESMTP id 08578-04; Fri,  7 Jul 2006 14:12:10 +1200 (NZST)
    Jul  7 14:12:10 aqua amavis[8578]: (08578-04) Checking: <persona@gmail.com> -> <a@myserver.co.nz>,<b@myserver.co.nz>
    Jul  7 14:12:11 aqua amavis[8578]: (08578-04) spam_scan: hits=0.087 tests=HTML_40_50,HTML_MESSAGE
    Jul  7 14:12:11 aqua amavis[8578]: (08578-04) FWD via SMTP: [127.0.0.1]:10025 <persona@gmail.com> -> <a@myserver.co.nz>,<b@myserver.co.nz>
    Jul  7 14:12:11 aqua amavis[8578]: (08578-04) Passed, <persona@gmail.com> -> <a@mysever.co.nz>,<b@myserver.co.nz>, Message-ID: <0
    01f01c6a16a$c5c1de20$4503a8c0@Mike>, Hits: 0.087
    Jul  7 14:12:11 aqua postfix/smtp[8931]: 44C6554EAA: to=<a@myserver.co.nz>, relay=127.0.0.1[127.0.0.1], delay=1, status=sent (250 2.6.
    0 Ok, id=08578-04, from MTA: 250 Ok: queued as 17E4454EB6)
    Jul  7 14:12:11 aqua postfix/smtp[8931]: 44C6554EAA: to=<b@myserver.co.nz>, relay=127.0.0.1[127.0.0.1], delay=1, status=sent (250 2.6
    .0 Ok, id=08578-04, from MTA: 250 Ok: queued as 17E4454EB6)
    Jul  7 14:12:11 aqua postfix/qmgr[31036]: 44C6554EAA: removed
    Jul  7 14:12:11 aqua postfix/pipe[8936]: 17E4454EB6: to=<a@myserver.co.nz>, relay=virtual, delay=0, status=sent (xxxxx.co.nz)
    Jul  7 14:12:11 aqua postfix/pipe[8936]: 17E4454EB6: to=<b@myserver.co.nz>, relay=virtual, delay=0, status=sent (xxxxx.co.nz)
    Jul  7 14:12:11 aqua postfix/qmgr[31036]: 17E4454EB6: removed

    Its the same with CC and BCC emails, and the same if the sender address is from an external address, or an internal address on my server.

    Anyone experienced this, or something similar where CC/BCC emails don't get delivered?

    One thing to note, is that if an email like the following is sent (internal user sends to external user, and CC's to internal user), then it works fine:
    From: a@myserver.co.nz
    To: persona@gmail.com
    CC: b@myserver.co.nz
    Subject: foobar
    ...
     
    Last edited: Oct 23, 2008
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    But the mails have been sent:
    Does b@myserver.co.nz maybe point to the same mailbox as a@myserver.co.nz?
     
  3. snowfly

    snowfly Member

    No, they are completely seperate mailboxes.

    I just did another test, and it seems its not just CC/BCC mail, its any mail delivered to 2 or more mailboxes on my server.

    Eg, if persona@gmail.com sent an email with headers: To: <a@mysever.co.nz>, <b@myserver.co.nz>
    Then only a@myserver.co.nz receives the mail, not b@myserver

    Its weird that in the 1-2 years I've had this server running, I never even noticed this fault!! Bugger!
    So any email sent to more than 1 person on my server, only the first person received it, no one else.

    Its weird cause in the log, the emails have the same ID, eg: 17E4454EB6
     
  4. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Have you checked your Postfix transport rules, aliases, etc.?
     
  5. snowfly

    snowfly Member

    Hi, ok here is my postfix config:

    transport.cf:
    Code:
    user = postfix
    password = ********
    dbname = xxxxx
    table = email_domains
    select_field = transport
    where_field = domain
    hosts = 127.0.0.1
    aliases.cf:
    Code:
    user = postfix
    password = *******
    dbname = xxxxx
    table = email_addresses
    select_field = maildir
    where_field = email
    hosts = 127.0.0.1
    remote_aliases.cf:
    Code:
    user = postfix
    password = *********
    dbname = xxxxx
    table = email_aliases
    select_field = remote_address
    where_field = email
    hosts = 127.0.0.1
    And here's the end of my main.cf file:
    Code:
    myhostname = aqua.xxxxx.co.nz
    myorigin = /etc/mailname
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    program_directory = /usr/lib/postfix
    mydestination = mail.xxxxx.co.nz, aqua.xxxxx.co.nz, aqua, mail.xxxxx.co.nz
    relayhost =
    
    transport_maps = mysql:/etc/postfix/transport.cf
    virtual_mailbox_base = /
    virtual_uid_maps = static:1001
    virtual_gid_maps = static:1001
    virtual_mailbox_maps = mysql:/etc/postfix/aliases.cf
    virtual_maps = mysql:/etc/postfix/remote_aliases.cf
    
    qmgr_message_active_limit = 100
    qmgr_message_recipient_limit = 100
    
    content_filter = smtp-amavis:[127.0.0.1]:10024
    
    message_size_limit = 51200000
    unknown_local_recipient_reject_code = 450
    
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain = $myhostname
    broken_sasl_auth_clients = yes
    Can you see anything wrong with my config, or anything that might suggest why emails aren't being delivered to the 2nd, 3rd... addressed users when sent to multiple users?

    I can provide more of the main.cf file, or other files, just let me know what parts.

    Thanks, Mike
     
    Last edited: Oct 23, 2008
  6. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Ok, you have all your data in a MySQL database, so you should check the MySQL database if there's some problem with the data (aliases, transports, etc.) that causes your problem.
     
  7. snowfly

    snowfly Member

    The MySQL database seems fine. All of the data seems fine, and if manually run queries based on those that postfix is using (to get transport, aliases, and remote_aliases, they all return data ok.

    And as the mail server has been handling email perfectly ok for 1 person in the "to" field, then the database seems to be fine.

    Maybe its something else?
    Amavis, or maildrop?
     
  8. snowfly

    snowfly Member

    Ok, finally found a part solution!!!

    Seems other people have had this problem too.

    In the maildrop README.postfix file, I found this:

    Ok, so I added the "maildrop_destination_recipient_limit = 1" line to my postfix main.cf file.
    Then reloaded postfix, tested by sending email with multiple recipients, and it didn't work.

    So I tried something different, turning off content filtering (spam/virus filtering with clamav, spamassassin, via amavisd).
    I did this by commenting out this line in main.cf:

    Code:
    #content_filter = smtp-amavis:[127.0.0.1]:10024
    Then reloaded again, tested, and YAY it worked! It was correctly delivering to all recipients!!!

    So, why I wonder does it not work when the "content_filter" is turned on?
    Only when its off?

    Thats the next thing I'll have to find out.
    I can't leave the content-filter off, as its removes on average 500 spam and 10 virus emails every day!

    Mike
     
  9. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What's in /etc/amavis/amavisd.conf?
     
  10. snowfly

    snowfly Member

    Well after further testing, I found that in fact 99% of mail is now working correctly! With content-filter turned on.

    The only thing that isn't working with 'content-filter' on, is if I send an email like the following:
    From: external address
    To: persona@myserver.co.nz
    CC: persona@myserver.co.nz

    Eg, if I send an email to the same person, in 'To', and 'CC'. Or the same person in 'To' twice.
    Or if I send to persona@myserver.co.nz and an alias (eg foobar@myserver.co.nz) that forwards to the same address, persona@xxxxx.co.nz

    But I'm thinking thats how mail servers are supposed to work?
    If an email is addressed to the same person more than once, it only delivers it once.

    That was were I was getting the problem above, i was sending email to myself, and an alias to myself.

    All other mail now works fine!!
    So the amavisd content filter is working.

    Thanks falko for your assistance!

    Hopefully this helps someone else, if they have the same issue.
     
    Last edited: Oct 23, 2008
  11. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    That's the normal behaviour. :)
     

Share This Page