I have a dedicated server with multiple Ruby on Rails apps on it. Each of these apps run on their own domain. When configuring Postfix there are parameters called "myhostname" and "mydomain". As far as I can see they accept one domain only and when sending mails from my apps, the domain in this field indeed states this as the sending server (in the raw gmail email for example) no matter what the "From" tag in the email says. Ideally I want domain2.com to be the sending server if I send mail from info@domain2.com, even if domain1.com is the "mydomain". My questions are:

  • Can I change the sending server according to the email actually used when sending?
  • Is this a big deal, and how do others solve this issue?

I only use Postfix on this server for sending e-mails, not receiving. Grateful for any suggestions.

Thank you


As you accept all mails from 'mynetworks' (by default), this does not affect the sending side (Have a look at where permit_mynetworks is included). If the sender is not in mynetworks, you should do authentication, to trigger permit_sasl_authenticated and let the mails through.

For the receiving side, list your domains in mydestination.

  • So basically you're saying if the network is allowed (same ip for all domains on this server) on the mail server I can send mail from another server domain (not to be confused by the sender address) without them ending up in spam filters etc because the origin is different/suspect? If I look in the raw e-mail, what I'm talking about is the "Received: from domain1.com" when it's actually domain2.com that is sending the mail. – miccet Oct 17 '14 at 10:23
  • If you have different servers which do send mail through the one mailserver, put them all (your own (sub)network) in mynetworks. – sebix Oct 17 '14 at 15:01
  • I have one physical server with different apps sending mail through postfix which is on the same server. Looking at some other mails coming in it seems like it doesn't need to come from the domain the email is sent from anyway, so I guess I'll just let it be. – miccet Oct 17 '14 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.