Discussion in 'Installation/Configuration' started by poda3, May 14, 2013.

  1. poda3

    poda3 New Member


    let's say my domain is named "domain.tld" and the domain mails are hosted by a third party ISP so the MX record points to a ISP's public IP address.

    I wanted to backup in a centralized place all the accounts incoming mails so I set an ISPConfig server in my office and configured on it the domain "domain.tld" and all the accounts also configured on the ISP mail server and then, I configured fetchmail to fetch periodically the incoming mail on the ISP accounts to te locals.

    I also configured a special account where all the incoming mail are placed in by copy using the "always_bcc" postfix directive.

    Now I want to use the ISPConfig server also as a SMTP Outgoing server for the clients inside my network.
    To do that I provided the server with a public IP address and I configured the clients to use it.

    The problem, of course, is that when a mail is sent from an internal account to another internal account, the ISPConfig server delivers it locally, without send it to the ISP, because the domain "domain.tld" is configured on ISPConfig.

    I want to avoid this behavior and force postfix to send the mails to the public mx server, regardless of where the domain is hosted.

    I tried to configure the domain itself inside the "mail routing" section, adding the domain as a new transport.
    This actually works BUT it generates a mail loop to the ISP accounts:

    The mail is sent to the ISP, then it is fetched by fetchmail and, once is fetched, it is automatically delivered again to the ISP, and so on for 5 or 6 times when the loop is blocked by the anti-loop system.

    I then tried to add the lines:

    -o virtual_mailbox_domains=
    -o virtual_mailbox_maps=
    -o relayhost=mx.mydomain.tld

    to my file in the sections "smtp", "smtps" and "submission" but no luck.

    Anyone can help me with this?

    Thank you in advance.
  2. tahunasky

    tahunasky Member

    I understand what you want to do, but i cant understand why you want to do this ??

    However why dont you just setup the email clients to use the IPS's smtp server, and by-pass your server altogether ?
  3. poda3

    poda3 New Member

    We are already using the ISP SMTP server.
    We want to use our internal mailserver in order to backup the outgoing mails.

    Fetchmail seems to fetch just the inbox directory.
  4. tahunasky

    tahunasky Member

    Fetchmail is only designed to fetch new emails, and new emails are sent to the INBOX.
    All other mail boxes are used by the email client. eg: when you send an email from outlook, windows live mail, thunderbird or squirrelmail email clients, you tell the client in the configuration where to put sent/trash/draft etc.
    This is either a local folder on the PC or an IMAP folder on the server. When sending an email the email client connects to the smtp server, sends the email, and then when it is sent puts the email in the correct folder - usually moving from outbox to sent folders.

    So if it was me, i would use IMAP on your server for storing emails, and the ISP's smtp server for sending. I would use fetchmail to get the new emails from the ISP's server and put them in your servers users INBOX's. Any emails the users send are stored on your server in their SENT folder, which you can backup, or copy somewhere else with a script that is run everynight.

    I do what you want (without fetchmail) where i backup all emails to backup device, and also have another server connect to the email server and rsync all users email boxes.
    You can also tell it to
  5. poda3

    poda3 New Member

    Unfortunatly I can't do that.

    Is there a way to avoid the loop or another way to configure postfix to not deliver locally the mails?

    Thank you

Share This Page