0

I have a mail server all set up and running on ubuntu 14.04 with Postfix / Dovecot for the domain "postfixserver.com".

A second domain "googleapps.com" is running on google apps.

user@googleapps.com emails are forwarded from google apps to user@postfixserver.com.

When user@postfixserver.com replies to an email addressed to user@googleapps.com I would like postfix to send the email out as being from user@googleapps.com.

Is there any way to achieve this without having to rely on the email client. So for instance on an iPhone I would like to only setup one account user@postfixserver.com but being able to reply to emails sent to user@googleapps.com keeping the correct from address.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
  • Google...first result: http://www.postfix.org/ADDRESS_REWRITING_README.html – flashbang Dec 04 '14 at 15:13
  • Thank you for this but still can't get my head around it. I am assuming that from the link above what I need to look at is the "Generic mapping for outgoing SMTP email". If that is the case editing: /etc/postfix/main.cf by adding smtp_generic_maps = hash:/etc/postfix/generic and then inside my generic user@googleapps.com user@postfixserver.com? I am also assuming I will need an spf record setup on the googleapps domain to allow the other server to send emails using that address? –  Dec 04 '14 at 15:34
  • Sounds like you've got it! – flashbang Dec 04 '14 at 15:40
  • Just tested this and it's not working. From a third domain I send an email to the googleapps domain than gets automatically forwarded to the postfixdomain. When I reply from the postfix domain the third domain gets the reply with the from address from the postfix domain. Any ideas? –  Dec 04 '14 at 16:59
  • Oops, my mistake I had to invert the addresses in the generic db. Still in the header of the email I can see the postfix email address. Do you know if there is any way to hide that? –  Dec 04 '14 at 17:07
  • Scrap that it's not working. Now every email sent is sent using the from address replaced by the generic. So even emails sent from a third domain directly to the postfix domain get the address of the google domain when replied. –  Dec 04 '14 at 17:09

1 Answers1

1

TLDR: No. You can't. It isn't MTA job.


Suppose external address send email to gapps domain. Here the full email looks like

From: alice@external.example.com
To: user@GAPPS.example.net
Subject: Hello World

This is 'Hello world' version of email

Because user@GAPPS.example.net forwarded it to postfix.example.org then user@postfix.example.org get and read the email.

Now user@postfix.example.org wants to reply it. IPhone compose the emails and sent to postfix. Here the example reply which postfix would see from user@postfix.example.org

From: user@postfix.example.org
To: alice@external.example.com
Subject: Re: Hello World

On 7 Mar 2014, at 21.21, Someone <alice@external.example.com> wrote: 
> This is 'Hello world' version of email

Okay hello world. Your email was received :)

You can see that in the second email there is no trace that alice@external.example.com have sent email to GAPPS.example.net.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
  • Unfortunately for me the above makes perfect sense. Is there anything that can be done at the time the email gets delivered to postfix or at the time it's forwarded from the google apps? Or any other solution that would not involve the mail client? –  Dec 05 '14 at 08:52
  • I think that's not possible. You can't control how mail client compose the message for you – masegaloeh Dec 05 '14 at 13:48