0

I know that this might seems to be a lame question but hey , let me give it a try ...

Hi, I am hosting different domains and trying to configure postfix to send mails through sendgrid for certain domains with different authentication, and the rest of the remaining domains to use postfix's local settings to send mail normally i.e using my default relay host, here is what I managed to compile from their website and added my settings

/etc/postfix/main.cf:
    smtp_sender_dependent_authentication = yes
    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    relayhost = my.default.relay.com

/etc/postfix/sasl_passwd:
    # Per-sender authentication; see also /etc/postfix/sender_relay.
    user1@example0.com                  apikey:thatAPIkeyfromSendGrid
    @domain1.example1.com               username1:password1
    @domain2.example.com                username2:password2
    # Login information for the default relayhost(which is?)
    [my.default.relay.com]              username:password

/etc/postfix/sender_relay:
    # Per-sender provider; see also /etc/postfix/sasl_passwd.
    @domain1.example.com               [sendgrid.net]:submission
    @domain2.example.com               [sendgrid.net]:submission

Now for some reason , I cannot figure it out my default relay host? I tried

relay_host = 

and

relay_host = $domain

also

relay_host = [my.default.relay.com]

In the end I still get mail for [my.default.relay.com] loops back to myself, off course I did the postmaps of sender_relay,sasl_passwd and change them to chmod 600

Can you help on finding out what my default relay host is? Or a possible way to solve my problem?

PS: I am not into Open Relay though

  • So what is your default relay host? It sounds like you don't know. If you don't, then you should ask your company's mail administrator – Michael Hampton Sep 3 '18 at 16:33
1

The configuration parameter is relayhost, not "relay_host". You are asking what is your default relayhost and you have got an answer on how to figure it out. I think you're actually trying to ask what this should be.

The relayhost can be empty as it is by default. You don't need to have a relayhost unless your connectivity to the Internet on SMTP port 25 is limited. Postfix will by default query DNS for a mail exchanger MX record of the recipient domain and communicate directly with the receiving message transfer agent (MTA).

  • my bad, I meant relayhost and not relay_host as mentioned earlier, and YES , I am asking what should this be? – Fahad Sep 3 '18 at 13:32
  • Now if the above settings are correct then why can't I relay mails on my default machine and for other domains too, I keep on getting mail for [my.default.relay.com] loops back to myself, I still don't know the login details for my default relay host :( – Fahad Sep 3 '18 at 13:33
  • 1
    Just leave relayhost = empty and remove the [my.default.relay.com] username:password if you don't have one. – Esa Jokinen Sep 3 '18 at 13:37
  • Thank you for this suggestion, Let me try removing that, but one sec ... What about the remaining domains ,how will postfix know not to relay the whole machine but only some few? – Fahad Sep 3 '18 at 13:44
  • 1
    Based on the sender_dependent_relayhost_maps, maybe? :) – Esa Jokinen Sep 3 '18 at 13:55
1

For finding out the default relay host, did you already try out postconf relayhost command? And of course the mail logs should reveal you what's going on.

  • That's the setting that I am looking for , whenever I try changing the relayhost before sending mail I try to look for that , currently its empty since I don't know what to set in the first place :D , I tried localhost too but it does not seem to work, I think am missing something :( – Fahad Sep 3 '18 at 13:04

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.