ISPConfig + GoogleApps Split domain delivery

Discussion in 'ISPConfig 3 Priority Support' started by Ark74, Oct 18, 2017.

  1. Ark74

    Ark74 Member

    I'd like to move this question to this section, thanks in advance.

    I've been trying to setup a domain split configuration with Google Apps as the main mail controller.
    I've seen this post with CPanel and it makes a lot of sense, I'm trying to recreate it on ISPConfig,

    1. root domain (domain.com) must have MX records pointing to Google's MX servers;
    2. there must be a subdomain CNAME (gapps.domain.com) as alias of root domain (domain.com), this will be used to deliver mail sent through cPanel or its SMTP;
    3. there must be another subdomain CNAME (cp.domain.com) as alias to the cPanel hosting server (in my case, HostGator's server br###.hostgator.com.br, masked for example purposes);
    4. Google Apps Split Delivery must be correctly configured (Configure split delivery - Google Apps Administrator Help), with the subdomain described in step #3 as the destination (step 7 on this page);
    5. on cPanel, use Local Server as the setting on the MX Records page for the root domain;
    6. on cPanel, set a Domain Forwarder with "from: domain.com" and "to: gapps.domain.com";
    7. on Google Apps, set a default route to change envelope recipient of all mail that corresponds to the REGEXP "\[email protected]" with the "Replace Recipient" setting, set to the "[email protected]" option.

    https://forums.cpanel.net/threads/google-apps-split-delivery-for-domain.209402/#post-2260661

    I'm stuck at Point 5 forward, if i'm running DNS from the test server, I believe that that point is already done... maybe(?)
    On Point 6, should I Alias (Domain alias) or Route (Email Routing) the from domain.com => gapps.domain.com

    Any ideas or suggestions are welcome. :)
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I haven't used google apps nor do I know cpanel in details, so I can just guess what they mean.
    (5) They refer most likely to a normal MX record here.
    (6) is probably an email route.
     
  3. Ark74

    Ark74 Member

    Hi!

    On a follow up question, I've configured split delivery, and emails reach the ispconfig mail but I'm getting this weird behavior.

    Nov 1 11:18:21 pos postfix/smtp[20410]: 4B743272573: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.77, delays=0.4/0.01/0/0.36, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 05038272574)
    Nov 1 11:18:21 pos postfix/qmgr[18803]: 4B743272573: removed
    Nov 1 11:18:21 pos postfix/local[20415]: 05038272574: to=<[email protected]>, relay=local, delay=0.03, delays=0.01/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "address")​

    Where address is a valid email/mailbox on the ISPConfig server, seems that it's not reading the @domain.com
    Any advice?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Please check that domain.com is not used as server hostname and that it is not used in /etc/mailname or /etc/postfix/main.cf files. In these places, a subdomain must be used like server1.domain.com.
     
  5. Ark74

    Ark74 Member

    Edit: Sorry didn't see the message when I sent this one.
    ===============
    Seems that it is related to this other message.
    postfix/trivial-rewrite[19344]: warning: do not list domain domain.com in BOTH mydestination and virtual_mailbox_domains​
    Investigating this issue.
    ===============

    In fact I have in both places, domain.com
    Do I need to use a valid (DNS) subdomain or can it be a local.domain.com/other.domain.com?
     
    Last edited: Nov 1, 2017
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Try to remove it from mydestination line and then restart postfix.
     
  7. Ark74

    Ark74 Member

    Mmm, it complains about it.
    postfix/smtpd[23035]: connect from mail-lf0-f72.google.com[209.85.215.72]
    postfix/trivial-rewrite[23822]: fatal: myorigin file /etc/mailname is empty
    postfix/master[1943]: warning: process /usr/lib/postfix/sbin/trivial-rewrite pid 23822 exit status 1
    postfix/master[1943]: warning: /usr/lib/postfix/sbin/trivial-rewrite: bad command startup -- throttling​

    Should I change/remove from /etc/postfix/main.cf?
    At this test is still domain.com there.
     
  8. Ark74

    Ark74 Member

    Yay!

    If i left mailname with domain.com
    but change main.cf to sub.domain.com

    It works!
    It delivers the message! :)
     
  9. Ark74

    Ark74 Member

    Thank you very much for the heads up! :)

    Should I still change mailname to sub.domain.com?
     
  10. Ark74

    Ark74 Member

    After some tweaks its working.
    I can confirm it was email route (not alias).
    Priority support totally worth it.

    Thanks guys, cheers! ;)
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    If it's working now, then leave it as it is.
     
  12. Ark74

    Ark74 Member

    Maybe I talked to early.
    I've found that enabling email routing would prevent receiving mails on the valid ISPConfig accounts mailbox even when setting up relay recepient.
    Using Domain alias will not work either.

    The only missing feature is to send mail from a ISPConfig account to a GoogleApps hosted email address.
    Can send and retrieve from any email address (local and external) even from GoogleAPps to {ispc} local emails.

    So i guess this is a issue on forwarding domain -> gapps.domain.com
    how can it be accomplished making sense of these instructions.
    https://forums.cpanel.net/threads/google-apps-split-delivery-for-domain.209402/#post-1089342

    Thanks
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    You can not use relaying and local mailboxes for the same domain at the same time. Either email get's relayed, then gmail is responsible for it, or email is local, then your server is responsible for it and not gmail.
     
  14. Ark74

    Ark74 Member

    As far as I understand.
    That's the reason for using 2 identifiers one for each server.
    cp/ispc.domain.com -> ispc3 server
    gapps.domain.com -> google

    So emails sending from the ISPConfig server to [email protected] will rewrite to [email protected] and reach the Google server, once there #7 will change it back from gapps.domain.com to domain.com
    7. on Google Apps, set a default route to change envelope recipient of all mail that corresponds to the REGEXP "\[email protected]" with the "Replace Recipient" setting, set to the "[email protected]" option.
    I'm more of a graphic person, so this is my undestanding / state of the process. maps.png
    So if a subdomain won't work, should I get a different domain to pull this out?

    PS. Google Apps can receive mails delivered to @gapps.domain.com from the ispc3 and other hosts.
     
    Last edited: Nov 2, 2017
    sweekeong81 likes this.
  15. Ark74

    Ark74 Member

    Finally I got it working.
    Seems that I added the gapps alias domain to Google Apps at the end, so all my (previous) test were rejected and taken as wrong.
    Sorry for the silly mistake. After adding the domain alias to GoogleApps and setup MX records for gapps.domain.com pointing for GoogleApps.
    I only needed to add forward for each address with "send as" enabled. ispconifg.png
    Thanks again for the support.
     
    Turbanator and till like this.
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Thank you for posting your solution! I'm sure this will help others with a similar problem.
     

Share This Page