Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I don't know if relaying is the proper term, so forgive me.
I'm playing around with a home email server with virtual users, using postfix and dovecot.
What happens, is if I try to send an email to a virtual user that does not exist on the server, the email is rejected. What I would like to happen, is, if that user does not exist the email is passed on to another server.
Can this be done with postfix? I've looked at fallback_transport and fallback_relay as suggested by some duckduckgo-ing with no success.
I'd appreciate a nudge in the right direction, rather than the complete solution (I could always come back later if I can't get it on my own).
I'd looked into luser_relay, and unless I'm misunderstanding, it's not what I want.
Unfortunately, re-reading my post, maybe it's not as clear as I'd like. Let me give an example in the hopes it is clear.
I have a virtual user setup, with a PostgreSQL back end. So, it has tables for domains, users and aliases as is typical. Username is the full email address (user@domain).
I send an email to "goumba@example.net". This user is not one of the users on this particular server. Postfix looks, finds example.net, but no such user on the server. The email is bounced.
What I would like it to do now is instead of bouncing that email, is submit it to another SMTP server (be it postfix or whatever), untouched, as if it was being submitted through that server initially. Same exact username, etc.
So,
Code:
email to goumba@example.org -> submit to postfix -> not found -> submit to smtp.exampleserver2.net
What I would like it to do now is instead of bouncing that email, is submit it to another SMTP server (be it postfix or whatever), untouched, as if it was being submitted through that server initially. Same exact username, etc.
When the local(8) delivery agent finds that a message recipient does not exist, the message is normally returned to the sender ("user unknown"). Sometimes it is desirable to forward mail for non-existing recipients to another machine. For this purpose you can specify an alternative destination with the luser_relay configuration parameter.
My use case is a little, err, odd: like I said this is just to get myself learning the postfix, dovecot, virtual user set up. I must admit, I hadn't posted this all earlier as I was avoiding describing the case as I was expecting, knowing people, rather than try to help, I would get a "WHY ARE YOU DOING THIS?" and no help.
Basically, here goes.
I set up postfix + dovecot for mail delivery locally and sending with virtual users. These users are actually a few of my off site email addresses, using getmail and postfix+lmtp to store copies locally. This works. The problem is actually because of a bit of a clash of domains.
I send the email, and postfix looks in the pgSQL database of domains, finds gmail. Great. It should as it needs to do so to deliver MY mail locally.
It now looks up dudexx@gmail.com. BAM! Can't find it. Duh, not 'hosted' my on mail server. So, the email rightfully gets bounced.
gmail.com is not in mydestination, or other configuration directives in main.cf. The only place it is mentioned is in that pgSQL table.
What I would like to happen, just for the purposes of my use case, is to say 'ok, it's not here, now send it, exactly as is, to mail.example.net (not gmail's smtp, but that of my sending address) to be delivered. NO address writing or manipulation of the original email. I thought I understood fallback_transport to be a use for this along with local_recipient_maps = but it still bounces.
Relevant from log:
Code:
Sep 5 11:47:33 mail dovecot: lmtp(2461): Connect from local
Sep 5 11:47:33 mail postfix/lmtp[2632]: 386296C9599: to=<dudexx@gmail.com>, relay=mail[private/dovecot-lmtp], delay=0.41, delays=0.29/0.05/0/0.07, dsn=5.1.1, status=bounced (host mail[private/dovecot-lmtp] said: 550 5.1.1 <dudexx@gmail.com> User doesn't exist: dudexx@gmail.com (in reply to RCPT TO command))
Sep 5 11:47:33 mail dovecot: lmtp(2461): Disconnect from local: Successful quit
Sep 5 11:47:33 mail postfix/cleanup[2625]: 927EA6C95AA: message-id=<20160905154733.927EA6C95AA@mail>
Sep 5 11:47:33 mail postfix/bounce[2633]: 386296C9599: sender non-delivery notification: 927EA6C95AA
Sep 5 11:47:33 mail postfix/qmgr[2620]: 927EA6C95AA: from=<>, size=2126, nrcpt=1 (queue active)
Last edited by goumba; 09-05-2016 at 10:52 AM.
Reason: Some more clarification.
gmail.com is not in mydestination, or other configuration directives in main.cf. The only place it is mentioned is in that pgSQL table.
Ok I understand it's for learning purposes, but why put gmail.com into virtual domains. You should leave it apart, so postfix uses dns to find the correct MX host for gmail.com and deliver the email to it.
Re, your gmail account, you can setup forwarding to you local account.
Anyways, I've not tried anything similar, but perhaps you may give this a try.
Ok I understand it's for learning purposes, but why put gmail.com into virtual domains.
First thing I tried was removing it, and once I did postfix+lmtp stopped delivering mail locally to any affected account using that domain.
Quote:
Re, your gmail account, you can setup forwarding to you local account.
I know. The problem is not with my gmail account. It's with sending an email from the example.net account (which isn't really the domain name, the real domain is my personal domain) to a gmail account because of this set up.
Meh, thanks for your help. It seems this is something that can not be worked around. Thank you for your patience.
(I know this is an old post, my answer is more about guys facing the same issue today)
Maybe you could think your problem in a different way, if you know the "local" users you can create a virtual alias for them a redirect the other to your gateway.
For example :
In main.cf, remove your destination domain (example.net) from mydestination and create a virtual aliases map :
(I know this is an old post, my answer is more about guys facing the same issue today)
Maybe you could think your problem in a different way, if you know the "local" users you can create a virtual alias for them a redirect the other to your gateway.
For example :
In main.cf, remove your destination domain (example.net) from mydestination and create a virtual aliases map :
Usually you use the full email address like "user1@example.net".
"example.net" must be specified in "main.cf" as virtual domain: "virtual_mailbox_domains = example.net", otherwise the virtual alias map would be ignored.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.